Daniel P. Berrangé > Config-Record-1.0.0 > Config::Record

Download:
Config-Record-1.0.0.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  1
Open  0
View Bugs
Report a bug
Module Version: 1.0.0   Source  

NAME ^

Config::Record - loading of configuration records

SYNOPSIS ^

  use Config::Record;

  my $config = Config::Record->new(filename => $filename,
                                   cache => $cache,
                                   locales => [ "en_EN", "en_US"],
                                   path => \@path,
                                   data => \%data);
  
  my $param = $config->param($key, [$default]);

DESCRIPTION ^

This module provides 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....    "

Array values consist of a single right round bracket, following by one value per line, terminated by a single left round bracket. eg

  foo = (
    Wizz
    "Wizz...    "
  )

Hash values consist of a single right curly bracket, followed by one key,value pair per line, terminated by a single left curly bracket. eg

  foo = {
    one = Wizz
    two = "Wizz....  "
  }

Arrays and hashes can be nested to arbitrary depth. While array entries can be optionally separated by commas, howevere, this still does not allow more than one entry per line. Likewise lines can be terminated by a redundant semicolon if desired.

EXAMPLE ^

  name = Foo
  title = "Wizz bang wallop"
  eek = (
    OOhh
    Aahhh
    Wizz
  )
  people = (
    {
      forename = John
      surnamne = Doe
    }
    {
      forename = Some
      surname = One
    }
  )
  wizz = {
    foo = "Elk"
    ooh = "fds"
  }

METHODS ^

my $cache = Config::Record->new(filename => $filename, [cache => $cache], [locale => $locale], [path => \@path]);

Creates a new config object, loading parameters from the file specified by the filename parameter. The cache parameter optionally specifies an instance of the Cache::Cache interface to be used for caching the contents of a file.

AUTHORS ^

Daniel Berrange <dan@berrange.com>

COPYRIGHT ^

Copyright (C) 2000-2004 Daniel P. Berrange <dan@berrange.com>

SEE ALSO ^

perl(1)