Help-Site Computer Manuals
Software
Hardware
Programming
Networking
  Algorithms & Data Structures   Programming Languages   Revision Control
  Protocols
  Cameras   Computers   Displays   Keyboards & Mice   Motherboards   Networking   Printers & Scanners   Storage
  Windows   Linux & Unix   Mac

Config::Abstract
Perl extension for abstracting configuration files

Config::Abstract - Perl extension for abstracting configuration files


SYNOPSIS


 use Config::Abstract;

 my $ini = new Config::Abstract('testdata.pl');


DESCRIPTION


 Config::Abstract is the base  class for a  number of  other classes

 created to facilitate use and  handling of a  variety of  different

 configuration file formats. It uses the Data::Dumper file format to

 serialise it self and can be initialise from a file of that  format

 

=head1 EXAMPLES

 We assume the content of the file 'testdata.pl' to be:

 

  $settings = {

    'book' => {

      'chapter1' => {

        'title' => 'The First Chapter, ever',

        'file' => 'book/chapter1.txt'

      },

      'title' => 'A book of chapters',

      'chapter2' => {

        'title' => 'The Next Chapter, after the First Chapter, ever',

        'file' => 'book/chapter2.txt'

      },

      'author' => 'Me, Myself and Irene'

    }

  };

 use Config::Abstract;

 my $settingsfile = 'testdata.pl';

 my $abstract = new Config::Abstract($settingsfile);

 

 my %book = $abstract->get_entry('book');

 my %chap1 = $abstract->get_entry_setting('book','chapter1');

 my $chap1title = $chapter1{'title'};

 

 # Want to see the file?

 # If you can live without comments and blank lines ;),

 # try this:

 print("My abstract file looks like this:\n$abstract\nCool, huh?\n");

 

 # We can also create an ini file from it

 # A bit crude, but it does the job

 bless($abstract,'Config::Abstract::Ini');

 print($abstract);


METHODS

get_all_settings
Returns a hash of all settings found in the processed file

get ENTRYPATH
Returns the setting at the given 'path' where the path divider is '//'.

get_entry ENTRYNAME
Returns a hash of the settings within the entry ENTRYNAME. OBSOLETE, use get instead

get_entry_setting ENTRYNAME,SETTINGNAME [,DEFAULTVALUE]
Returns the value corresponding to ENTRYNAME,SETTINGSNAME. If the value isn't set it returns undef or, optionally, the DEFAULTVALUE. OBSOLETE, use get instead

set_all_settings SETTINGSHASH
Fill settings with data from SETTINGSHASH

set ENTRYPATH VALUE
Setting the entry at the given 'path', where the path divider is '//', to VALUE.

set_entry ENTRYNAME,ENTRYHASH
Fill the entry ENTRYNAME with data from ENTRYHASH

set_entry_setting ENTRYNAME,SETTINGNAME,VALUE
Set the setting ENTRYNAME,SETTINGSNAME to VALUE

diff OBJECT
Returns an object of type Config::Abstract that is a representation of the values in this object that needs altering to make it identical to OBJECT

patch OBJECT
Sets the entries in this object to whatever they are in OBJECT, creating entries as necessary. $obj_a->patch( $obj_a->diff( $obj_b ) ); should make $obj_a identical to $obj_b except for entries in obj_a that don't exist in $obj_b.


COPYRIGHT

Copyright (c) 2003 Eddie Olsson. All rights reserved.


 This library is free software; you can redistribute it

 and/or modify it under the same terms as Perl itself.


AUTHOR

Eddie Olsson <ewt@avajadi.org>


SEE ALSO

perl.

Programminig
Wy
Wy
yW
Wy
Programming
Wy
Wy
Wy
Wy