Config::Record

Config::Record is a Perl module with configuration file access.
Download

Config::Record Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Daniel Berrange
  • Publisher web site:
  • http://search.cpan.org/~danberr/Config-Record-1.1.2/lib/Config/Record.pod

Config::Record Tags


Config::Record Description

Config::Record is a Perl module with configuration file access. SYNOPSIS use Config::Record; # Create an empty record & then load from file my $config = Config::Record->new(); $config->load("/etc/myapp.cfg"); # Create & load, then save to filename my $config = Config::Record->new(file => "/etc/myapp.cfg"); $config->save("/etc/myapp.cfg"); # Load / save from filehandle my $fh = IO::File->new("/etc/myapp.cfg"); my $config = Config::Record->new(file => $fh); $config->save($fh); # Get a config value, throw error if not found my $value = $config->get("foo"); # Get a config value, return 'eek' if not found my $value = $config->get("foo", "eek"); # Set a value $config->set("foobar", "wizz"); # Get a deep config value (ie nested hash) my $value = $config->get("foo/bar", "eek"); # Get first element of an array param my $value = $config->get("people//forename"); # Get the raw hash reference forming the record my $record = $config->record(); # Get a new config object rooted at a sub-hash my $config = $config->view("foo");This module provides an API for loading and saving of simple configuration file records. Entries in the configuration file are essentially key,value pairs, with the key and values separated by a single equals symbol. The key consists only of alphanumeric characters. There are three types of values, scalar values can contain anything except newlines. Trailing whitespace will be trimmed unless the value is surrounded in double quotes. eg foo = Wizz foo = "Wizz.... "Long lines can be split with a backslash character, without introducing newlines. Without double quotes, whitespace at beginning and end of lines will be trimmed eg foo = This is a long line of text foo = "This is a long " "line of text"Multi-line strings can be provided as 'HERE' documents, eg foo =


Config::Record Related Software