NAME
Parrot::Configure::Data - Configuration data container
SYNOPSIS
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);
DESCRIPTION
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:
USAGE
Constructor
new()
- Purpose
- Arguments
- Return Value
Basic object constructor.
None.
Parrot::Configure::Data object.
Methods for Main Configuration Data
get($key, ...)
- Purpose
- Arguments
- Return Value
set($key => $val, ...)
- Purpose
- Arguments
- Return Value
add($delim, $key => $val, ...)
- Purpose
- Arguments
- Return Value
keys()
- Purpose
- Arguments
- Return Value
get_PConfig()
- Purpose
- Arguments
- Return Value
get_PConfig_Temp()
- Purpose
- Arguments
- Return Value
dump()
- Purpose
- Arguments
- Key in Parrot::Configure object's data structure which is being dumped.
- Name of the dumped structure.
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.
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.
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.
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.
Slurps in Parrot::Config data from previous run of Configure.pl.
None.
Reference to hash holding main Parrot::Configure data structure.
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.
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()
- Purpose
- Arguments
- Return Value
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.
Triggers
settrigger($key, $trigger, $cb)
- Purpose
- Arguments
- Return Value
gettriggers($key)
- Purpose
- Arguments
- Return Value
gettrigger($key, $trigger)
- Purpose
- Arguments
- Return Value
deltrigger($key, $trigger)
- Purpose
- Arguments
- Return Value
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.
Get the names of all triggers set for $key
.
String holding single key name.
List of triggers set for that key.
Get the callback set for $key
under the name $trigger
Accepts a key name & a trigger name.
CODE
ref.
Removes the trigger on $key
named by $trigger
Accepts a key name & a trigger name.
Parrot::Configure::Data object.
Methods for Perl 5 Data
get_p5($key, ...)
- Purpose
- Arguments
- Return Value
- Note
set_p5($key => $val, ...)
- Purpose
- Arguments
- Return Value
- Examples
- Note
keys_p5()
- Purpose
- Arguments
- Return Value
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.
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.
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.
CREDITS
Based largely on code written by Brent Royal-Gordon brent@brentdax.com
.
AUTHOR
Joshua Hoblitt jhoblitt@cpan.org
SEE ALSO
docs/configuration.pod, Parrot::Configure, Parrot::Configure::Step, Parrot::Configure::Step