The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

 Plugins::SimpleConfig

SYNOPSIS

 use Plugins::SimpleConfig;

 {
        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:

$pkgself

Either the class name or an instance object depending on when it was called. It will usually be an instance object.

$key

The configuration item being set.

$value

The new value.

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:

 use Plugins::SimpleConfig;

 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, @_);
 }