Parse::PlainConfig

Parser for plain-text configuration files
Download

Parse::PlainConfig Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Arthur Corliss
  • Publisher web site:
  • http://search.cpan.org/~corliss/

Parse::PlainConfig Tags


Parse::PlainConfig Description

Parser for plain-text configuration files Parse::PlainConfig is a Perl module that provides OO objects which can parse and generate human-readable configuration files.SYNOPSIS use Parse::PlainConfig; $conf = new Parse::PlainConfig; $conf = Parse::PlainConfig->new( 'PARAM_DELIM' => '=', 'FILE' => '.myrc', 'MAX_BYTES' => 65536, 'SMART_PARSER => 1, ); $conf->property(PARAM_DELIM => '='); $rv = $conf->read('myconf.conf'); $rv = $conf->read; $rv = $conf->readIfNewer; $conf->write('.myrc', 2); $conf->purge; @parameters = $conf->parameters; $conf->parameter(FOO => "bar"); $value = $conf->parameter(FOO); $conf->describe(FOO => 'This is foo'); $conf->coerce("string", qw(FOO BAR)); @order = $conf->order; $conf->order(@new_order); $errstr = Parse::PlainConfig::ERROR; $rv = $conf->hasParameter('FOO');The following methods are only supported for backwards compatibility reasons. They will likely be removed at some point in the future. # Use of the tags DELIM and PURGE are deprecated in favour of # PARAM_DELIM, LIST_DELIM, HASH_DELIM, and AUTOPURGE $conf = Parse::PlainConfig->new( 'DELIM' => '=', 'PURGE' => 1, ); # As is the delim method since it works only on the tag delimiter $conf->delim('='); # Auto-purge should be enabled/disabled via the property method $conf->purge(1); # directives is replaced with parameters @directives = $conf->directives; # get/set methods are replaced with a unifed parameter method $field = $conf->get('KEY1'); ($field1, $field2) = $conf->get(qw(KEY1 KEY2)); $conf->set(KEY1 => 'foo', KEY2 => 'bar'); # This was just a really bad idea to begin with, plus it's # effective broken at this point (only returns a copy of the # internal hash now, so it's effectively read-only) $hashref = $conf->getRef; # This is just a wrapper for the class function $errstr = $conf->error Requirements: · Perl · Paranoid · Text::ParseWords · Text::Tabs


Parse::PlainConfig Related Software