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 contains configuration data for use by the other Parrot::Configure::* modules.
USAGE
Import Parameters
This module accepts no arguments to its import
method and exports no symbols.
Methods
Constructors
new()
-
Basic object constructor.
Accepts no arguments and returns a Parrot::Configure::Data object.
Object Methods
get($key, ...)
-
Provides access to key values.
Accepts a list and returns a list.
set($key =
$val, ...)>-
Modifies or creates a new value.
Accepts a list of
key => value
pairs and returns a 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
.Accepts a delimiter value followed by a list of
key => value
pairs and returns a Parrot::Configure::Data object. keys()
-
Provides a list of keys.
Accepts no arguments and returns a list.
slurp()
-
Slurps in Parrot::Config data from previous configure.
Accepts no arguments.
slurp_temp()
-
Slurps in Parrot::Config temporary data from previous configure. Only to be used when running
gen::makefiles
plugin.Accepts no arguments.
dump()
-
Provides a Data::Dumper serialized string of the objects key/value pairs suitable for being
eval
ed.Takes two 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});
Returns a string.
clean()
-
Deletes keys matching
/^TEMP_/
from the internal config store, and copies them to a special store for temporary keys. Keys using this naming convention are intended to be used only temporally, e.g. as file lists for Makefile generation. Temporary keys are used only to regenerate makefiles after configuration.Accepts no arguments and returns a 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 viaset
oradd
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 and returns a Parrot::Configure::Data object. gettriggers($key)
-
Get the names of all triggers set for
$key
.Accepts a key name and returns a list.
gettrigger($key, $trigger)
-
Get the callback set for
$key
under the name$trigger
Accepts a key name & a trigger name and returns a
CODE
ref. deltrigger($key, $trigger)
-
Removes the trigger on
$key
named by$trigger
Accepts a key name & a trigger name and returns a Parrot::Configure::Data object.
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::Base