NAME
Config::Param::FileWorker - work with Config::Param-style configuration files for this program
SYNOPSIS
my $pfw = Config::Param::FileWorker->new(\%config, \@pardef);
$param = $pfw->param();
$pfw->load_file($filename);
print "Got value $param->{key} for parameter key out of file $filename.\n";
DESCRIPTION
This facilitates changes to the configuration of a program while running by reading different config files on demand. See Config::Param for background and also on configuration syntax.
METHODS
- new
-
The constructor, taking Config::Param-style config hash and parameter definition.
my $pfw = Config::Param::FileWorker->new(\%config, \@pardef);
- param
-
Access the internal parameter storage for retrieval or modification.
$param = $pfw->param(); $param->{key} = $something;
- load_file
-
Load values from a configuration file.
$pfw->load_file($filename);
- store_file
-
Store values in a configuration file (overwrite it).
$pfw->store_file($filename);
- init_with_args
-
Parse command line arguments (@ARGV if none given explicitly) and indicated/automatically found configuration files. Basically this is how a normal program using Config::Param starts.
$pfw->init_with_args(); # uses @ARGV $pfw->init_with_args(\@args);
- load_defaults
-
Reset parameter storage to default values.
$pfw->load_defaults();
- store_defaults
-
Store current state of parameter storage as defaults.
$pfw->store_defaults();
AUTHOR
Thomas Orgis <thomas@orgis.org>
COPYRIGHT AND LICENSE
Copyright (C) 2005-2012, Thomas Orgis.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl 5.10.0. For more details, see the full text of the licenses in the directory LICENSES.
This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose.