Config::Properties

Config::Properties is a Perl module to read and write property files.
Download

Config::Properties Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Randy Jay Yarger
  • Publisher web site:
  • http://search.cpan.org/~salva/Config-Properties-0.65/Properties.pm

Config::Properties Tags


Config::Properties Description

Config::Properties is a Perl module to read and write property files. Config::Properties is a Perl module to read and write property files.SYNOPSIS use Config::Properties; # reading... open PROPS, "< my_config.props" or die "unable to open configuration file"; my $properties = new Config::Properties(); $properties->load(*PROPS); $value = $properties->getProperty( $key ); # saving... open PROPS, "> my_config.props" or die "unable to open configuration file for writing"; $properties->setProperty( $key, $value ); $properties->format( '%s => %s' ); $properties->store(*PROPS, $header );Config::Properties is a near implementation of the java.util.Properties API. It is designed to allow easy reading, writing and manipulation of Java-style property files.The format of a Java-style property file is that of a key-value pair seperated by either whitespace, the colon (:) character, or the equals (=) character. Whitespace before the key and on either side of the seperator is ignored.Lines that begin with either a hash (#) or a bang (!) are considered comment lines and ignored.A backslash () at the end of a line signifies a continuation and the next line is counted as part of the current line (minus the backslash, any whitespace after the backslash, the line break, and any whitespace at the beginning of the next line).The official references used to determine this format can be found in the Java API docs for java.util.Properties at http://java.sun.com/j2se/1.5.0/docs/api/java/util/Properties.html.When a property file is saved it is in the format "key=value" for each line. This can be changed by setting the format attribute using either $object->format( $format_string ) or $object->setFormat( $format_string ) (they do the same thing). The format string is fed to printf and must contain exactly two %s format characters. The first will be replaced with the key of the property and the second with the value. The string can contain no other printf control characters, but can be anything else. A newline will be automatically added to the end of the string. You an get the current format string either by using $object->format() (with no arguments) or $object->getFormat().If a recent version of module Text::Wrap is available, long lines are conveniently wrapped when saving. Requirements: · Perl


Config::Properties Related Software