Parrot::Configure::Data - Configuration data container
use Parrot::Configure::Data; my $data = Parrot::Configure::Data->new; my @values = $data->get(@keys); $data->set($key1 => $value1, $key2 => $value2); $data->add($delimiter, $key1 => $value1, $key2 => $value2); my @keys = $data->keys; my $serialized = $data->dump(q{c}, q{*PConfig}); $data->clean; $data->settrigger($key, $trigger, $cb); $data->gettriggers($key); $data->gettrigger($key, $trigger); $data->deltrigger($key, $trigger);
This module provides methods by which other Parrot::Configure::* modules can access configuration data.
The module supplies a constructor for Parrot::Configure::Data objects and three kinds of accessors:
%Config
new()
Purpose
Basic object constructor.
Arguments
None.
Return Value
Parrot::Configure::Data object.
get($key, ...)
Provides access to the values assigned to elements in the Parrot::Configure object's main data structure.
List of elements found in the Parrot::Configure object's main data structure.
List of values associated with corresponding arguments.
set($key => $val, ...)
Modifies or creates new values in the main part of the Parrot::Configure object's data structure..
List of key => value pairs.
key => value
add($delim, $key => $val, ...)
Either creates a new key or appends to an existing key, with the previous/new values joined together by $delim.
$delim
Delimiter value followed by a list of key => value pairs.
keys()
Provides a list of names of elements in the Parrot::Configure object's main data structure.
List of elements in the Parrot::Configure object's main data structure.
slurp()
Slurps in Parrot::Config data from previous run of Configure.pl.
Reference to hash holding main Parrot::Configure data structure.
slurp_temp()
Slurps in Parrot::Config temporary data from previous run of Configure.pl. Only to be used when running gen::makefiles plugin.
gen::makefiles
Reference to hash holding that part of the main Parrot::Configure data structure holding temporary data.
dump()
Provides a Data::Dumper serialized string of the objects key/value pairs suitable for being evaled.
eval
Two scalar arguments:
Key in Parrot::Configure object's data structure which is being dumped.
Name of the dumped structure.
Example:
$conf->data->dump(q{c}, q{*PConfig}); $conf->data->dump(q{c_temp}, q{*PConfig_Temp});
String.
clean()
Deletes keys matching /^TEMP_/ from the internal configuration store, and copies them to a special store for temporary keys. Keys using this naming convention are intended to be used only temporarily, e.g. as file lists for Makefile generation. Temporary keys are used only to regenerate makefiles after configuration.
/^TEMP_/
settrigger($key, $trigger, $cb)
Set a callback on $key named $trigger. Multiple triggers can be set on a given key. When the key is set via set or add then all callbacks that are defined will be called. Triggers are passed the key and value that was set after it has been changed.
$key
$trigger
set
add
Accepts a key name, a trigger name, & a CODE ref.
CODE
gettriggers($key)
Get the names of all triggers set for $key.
String holding single key name.
List of triggers set for that key.
gettrigger($key, $trigger)
Get the callback set for $key under the name $trigger
Accepts a key name & a trigger name.
CODE ref.
deltrigger($key, $trigger)
Removes the trigger on $key named by $trigger
get_p5($key, ...)
Retrieve data originally derived from the Perl 5 environment during configuration step init::defaults and stored in a special part of the Parrot::Configure::Data object.
init::defaults
List of elements found in the Perl 5-related part of the Parrot::Configure object's data structure.
Note
Once data from Perl 5's %Config or special variables has been stored in configuration step init::defaults, %Config and the special variables should not be further accessed. Use this method instead.
set_p5($key => $val, ...)
Looks up values from either (a) the %Config, located in Config.pm and imported via use Config;, associated with the instance of Perl ($^X) used to run Configure.pl and assigns those values to a special part of the Parrot::Configure::Data object.
use Config;
$^X
List of key => value pairs. If the key being set is from %Config, the corresponding value should have the same name. If, however, the key being set is a Perl 5 special variable (e.g., %^O), the corresponding value should be the 'English' name of that special variable as documented in perlvar (less the initial $, of course).
%^O
$
Examples
This method should only be used in configuration step init::defaults. It is not the method used to assign values to the main Parrot::Configure data structure; use set() (above) instead.
set()
keys_p5()
List of elements in the part of the Parrot::Configure object's data structure storing Perl 5 configuration data.
Based largely on code written by Brent Royal-Gordon brent@brentdax.com.
brent@brentdax.com
Joshua Hoblitt jhoblitt@cpan.org
jhoblitt@cpan.org
docs/configuration.pod, Parrot::Configure, Parrot::Configure::Step, Parrot::Configure::Step
To install Parrot::Op, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Parrot::Op
CPAN shell
perl -MCPAN -e shell install Parrot::Op
For more information on module installation, please visit the detailed CPAN module installation guide.