Author image James G Smith


Config::Pod - Configuration files in POD format


 use Config::Pod;

 my $cfg = new Config::POD;

 $cfg -> filename($filename) or $cfg -> text($podtext);

 $cfg -> exists( @path )
 $cfg -> val( @path )


Config::Pod allows configuration files to be written in POD. Any text may be included at any location without affecting the configuration since Config::Pod only pays attention to lines beginning with `='.

Headings must be properly nested (head1 followed by head3 is not allowed, but head3 followed by head2 is allowed).

The module searches for lines beginning with =head(\d+) and =item. Only items are leaf nodes and are stored in an array under the appropriate heading.



Given a list of keys, will return true if the list represents a (possibly empty) collection of leaf nodes (=items). Note that intermediate headings will return false.


If no arguments are present, returns the filename of the configuration source. If an argument is given, it tries to read the file and parse the contents.


Given a list of keys, will return an array (possibly empty) of keys which reside under the list.


Either an array or an array reference may be passed. The contents will be parsed as a POD file.


Given a list of keys, will return an array reference (possibly empty) of items.


The following is an example POD file.

 =head1 Section1

 =head2 Section2

 =over 4

 =item Item1

 =item Item2

 =back 4

 =head2 Section3

 =head3 SectionA

 =over 4

 =item ItemA

 =item ItemB

 =back 4

 =head2 Section4


The following values then are available:

 $cfg -> val( qw(section1 section2) ) == 
    [ 'Item1', 'Item2' ];
 $cfg -> val( qw(section1 section3 sectiona) ) ==
    [ 'ItemA', 'ItemB' ];
 $cfg -> keys( qw(section1) ) ==
    ( qw(section2 section3 section4) );


 $cfg -> exists( qw(section1 section4) );

should return true even though it has no values.

On the other hand,

 $cfg -> exists( qw(section1 section3) );

should return false since there is yet another heading under Section3.


James Smith <>


Copyright (C) 2001 Texas A&M University. All Rights Reserved.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

2 POD Errors

The following errors were encountered while parsing the POD:

Around line 41:

'=item' outside of any '=over'

Around line 68:

You forgot a '=back' before '=head1'