parrotcode: Configuration data container | |
Contents | Perl Modules |
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:
new()
Basic object constructor.
None.
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.
Parrot::Configure::Data object.
add($delim, $key => $val, ...)
Either creates a new key or appends to an existing key, with the previous/new values joined together by $delim
.
Delimiter value followed by a list of key => value
pairs.
Parrot::Configure::Data object.
keys()
Provides a list of names of elements in the Parrot::Configure object's main data structure.
None.
List of elements in the Parrot::Configure object's main data structure.
slurp()
Slurps in Parrot::Config data from previous run of Configure.pl.
None.
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.
None.
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 eval
ed.
Two scalar arguments:
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.
None.
Parrot::Configure::Data object.
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.
Accepts a key name, a trigger name, & a CODE
ref.
Parrot::Configure::Data object.
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
Accepts a key name & a trigger name.
Parrot::Configure::Data object.
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.
List of elements found in the Perl 5-related part of the Parrot::Configure object's data structure.
List of values associated with corresponding arguments.
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.
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).
Parrot::Configure::Data object.
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.
keys_p5()
Provides a list of names of elements in the Parrot::Configure object's main data structure.
None.
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
.
Joshua Hoblitt jhoblitt@cpan.org
docs/configuration.pod, Parrot::Configure, Parrot::Configure::Step, Parrot::Configure::Step
|