Why not adopt me?
This distribution is up for adoption!
If you're interested then please contact the PAUSE module admins via
email.
NAME
Plugins::SimpleConfig
SYNOPSIS
{
simple_config_line(\
%config_items
,
@_
);
}
sub
new
{
simple_new(\
%config_items
,
@_
);
}
DESCRIPTION
Plugins::SimpleConfig handles the configuration needs of Plugins plugins that do not have complex configuration requirements.
It understands a couple of different kinds of items things (as deteremined by the reftype()
of the value in the %config_items
hash):
- SCALAR
-
What you would expect.
- ARRAY
-
It pushes the new value onto the end of the array.
- CODE
-
It calls the function with the following arguments:
HOW TO USE IT
First, create a hash (%config_items
) that maps configuration names to references to configuration variables.
Second, include the code from the "SYNOPSIS" in your plugin:
my
$config_var1
=
'value1'
;
my
$config_var2
=
'value2'
;
my
%config_items
= (
var1
=> \
$config_var1
;
var2
=> \
$config_var2
;
);
sub
config_prefix {
return
'myname_'
};
sub
parse_config_line
{
simple_config_line(\
%config_items
,
@_
);
}
sub
new
{
simple_new(\
%config_items
,
@_
);
}