Alberto Manuel Brandão Simões > Lingua-NATools-v0.7.5 > Lingua::NATools::Config

Download:
Lingua/Lingua-NATools-v0.7.5.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Source  

NAME ^

Lingua::NATools::Config - Simple configuration file API

SYNOPSIS ^

  use NAT::Config;

  my $config = Lingua::NATools::Config->new("config.cnf");
  my $val = $config->param("key");
  $config->param("key", ++$val);
  $config->write;

DESCRIPTION ^

new

The NAT::Config object constructor receives the name of the file to be processed. It returns an NAT::Config object ready to be queried.

    my $cnf = Lingua::NATools::Config("/path/to/the/configuration/file")->new;

You can also create a configuration object from scratch:

    my $cnf = Lingua::NATools::Config->new;

param

This is the accessor method for any configuration parameter. Pass it just one argument and you'll get that parameter value. Pass a second argument and you are setting the parameter value.

   # get value for key "foo"
   $val = $cnf->param("foo");

   # set value "bar" for key "foo"
   $cnf->param("foo", "bar");

write

This is the method used to write down the configuration object to a file. If you have opened a configuration file with new, then you can just "save it":

   $cnf->write;

If you created a configuration object from scratch, you need to supply a filename:

   $cnf->write("file.cnf");

You can always force a filename.

AUTHOR ^

Alberto Manuel Brandao Simoes, <albie@alfarrabio.di.uminho.pt>

COPYRIGHT AND LICENSE ^

Copyright 2002-2012 by Natura Project http://natura.di.uminho.pt

This library is free software; you can redistribute it and/or modify it under the GNU General Public License 2, which you should find on parent directory. Distribution of this module should be done including all NATools package, with respective copyright notice.

syntax highlighting: