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;
$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 it's 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.
dump()
-
Provides a Data::Dumper serialized string of the objects key/value pairs suitable for being
eval
ed. The variable name of the structure isPConfig
.Accepts no arguments and returns a string.
clean()
-
Deletes keys matching
/^TEMP_/
. Keys using this naming convention are intended to be used only temporally, e.g. as file lists for Makefile generation.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