NAME

Parse::PerlConf - common project configuration based on ``eval''-ing values


SYNOPSIS

  my $cfg = new Parse::PerlConf($config_filename)
  my $dir = $cfg->get_constant('PUBLISH_HOME');


DESCRIPTION

Parse::PerlConf object is used to get constant or dynamic value by name. The value is actually gotten by ``eval''-ing the associated perl expression.

Line format in config file is:

constant_name[TAB]perl_constant_value

Backslash at the end of line can be used to continue a value definition on the next line. It is possible to use spaces instead of [TAB].

When get_constant method is called with or without additional arguments perl_constant_value is evaluated and $a, $b up to $j are substituted by method's additional arguments (maximum 10).


CONSTRUCTORS

new

parameters
First argument is a class name, as usual. The second parameter is either config_filename or config_content_scalarref or constants_hashref.

returns
Instance of this class.


METHODS

get_constant

usage
  my $dir = $cfg->get_constant('PUBLISH_DIR');
  my @subdirs = $cfg->get_constant('PUBLISH_SUBDIRS', 'Article');
description
The method gets constant value by passed constant name and ``perl-eval''s it. Variables $a, $b etc. in ``perl-eval''ed value are substituted by additional arguments given to this method.

parameters
First argument is a constant name. Additional arguments are used when constant value is complex perl expression.

returns
Evaluated value of the constant in array context. If scalar context is requested, the first array element will be returned.