Plugins::SimpleConfig
use Plugins::SimpleConfig; { simple_config_line(\%config_items, @_); } sub new { simple_new(\%config_items, @_); }
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):
reftype()
%config_items
What you would expect.
It pushes the new value onto the end of the array.
It calls the function with the following arguments:
Either the class name or an instance object depending on when it was called. It will usually be an instance object.
The configuration item being set.
The new value.
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, @_); }
To install Plugins, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Plugins
CPAN shell
perl -MCPAN -e shell install Plugins
For more information on module installation, please visit the detailed CPAN module installation guide.