<HTML>
<HEAD>
<TITLE>Config::IniFiles - A module for reading .ini-style configuration files.</TITLE>
<LINK REV="made" HREF="mailto:ActivePerl@ActiveState.com">
</HEAD>

<BODY>

<A NAME="__index__"></A>
<!-- INDEX BEGIN -->

<UL>

	<LI><A HREF="#name">NAME</A></LI>
	<LI><A HREF="#synopsis">SYNOPSIS</A></LI>
	<LI><A HREF="#description">DESCRIPTION</A></LI>
	<LI><A HREF="#file format">FILE FORMAT</A></LI>
	<LI><A HREF="#usage  object interface">USAGE - Object Interface</A></LI>
	<LI><A HREF="#methods">METHODS</A></LI>
	<UL>

		<LI><A HREF="#new ( [option=>value ...] )">new ( [-option=&gt;value ...] )</A></LI>
		<LI><A HREF="#val ($section, $parameter)">val ($section, $parameter)</A></LI>
		<LI><A HREF="#setval ($section, $parameter, $value, [ $value2, ... ])">setval ($section, $parameter, $value, [ $value2, ... ])</A></LI>
		<LI><A HREF="#newval($section, $parameter, $value [, $value2, ...])">newval($section, $parameter, $value [, $value2, ...])</A></LI>
		<LI><A HREF="#delval($section, $parameter)">delval($section, $parameter)</A></LI>
		<LI><A HREF="#readconfig">ReadConfig</A></LI>
		<LI><A HREF="#sections">Sections</A></LI>
		<LI><A HREF="#sectionexists ( $sect_name )">SectionExists ( $sect_name )</A></LI>
		<LI><A HREF="#addsection ( $sect_name )">AddSection ( $sect_name )</A></LI>
		<LI><A HREF="#deletesection ( $sect_name )">DeleteSection ( $sect_name )</A></LI>
		<LI><A HREF="#parameters ($sect_name)">Parameters ($sect_name)</A></LI>
		<LI><A HREF="#groups">Groups</A></LI>
		<LI><A HREF="#setgroupmember ( $sect )">SetGroupMember ( $sect )</A></LI>
		<LI><A HREF="#removegroupmember ( $sect )">RemoveGroupMember ( $sect )</A></LI>
		<LI><A HREF="#groupmembers ($group)">GroupMembers ($group)</A></LI>
		<LI><A HREF="#writeconfig ($filename)">WriteConfig ($filename)</A></LI>
		<LI><A HREF="#rewriteconfig">RewriteConfig</A></LI>
		<LI><A HREF="#setfilename ($filename)">SetFileName ($filename)</A></LI>
		<LI><A HREF="#setsectioncomment($section, @comment)">SetSectionComment($section, @comment)</A></LI>
		<LI><A HREF="#getsectioncomment ($section)">GetSectionComment ($section)</A></LI>
		<LI><A HREF="#deletesectioncomment ($section)">DeleteSectionComment ($section)</A></LI>
		<LI><A HREF="#setparametercomment ($section, $parameter, @comment)">SetParameterComment ($section, $parameter, @comment)</A></LI>
		<LI><A HREF="#getparametercomment ($sect, $parm)">GetParameterComment ($sect, $parm)</A></LI>
		<LI><A HREF="#deleteparametercomment ($sect, $parm)">DeleteParameterComment ($sect, $parm)</A></LI>
		<LI><A HREF="#getparametereot ($section, $parameter)">GetParameterEOT ($section, $parameter)</A></LI>
		<LI><A HREF="#setparametereot ($section, $eot)">SetParameterEOT ($section, $EOT)</A></LI>
		<LI><A HREF="#deleteparametereot ($sect, $parm)">DeleteParameterEOT ($sect, $parm)</A></LI>
		<LI><A HREF="#delete">Delete</A></LI>
	</UL>

	<LI><A HREF="#usage  tied hash">USAGE - Tied Hash</A></LI>
	<UL>

		<LI><A HREF="#tie $ini, 'config::inifiles', (file=>$filename, [option=>value ...] )">tie $ini, 'Config::IniFiles', (-file=&gt;$filename, [-option=&gt;value ...] )</A></LI>
		<LI><A HREF="#$val = $ini{$section}{$parameter}">$val = $ini{$section}{$parameter}</A></LI>
		<LI><A HREF="#$ini{$section}{$parameter} = $value;">$ini{$section}{$parameter} = $value;</A></LI>
		<LI><A HREF="#%hash = %{$ini{$section}}">%hash = %{$ini{$section}}</A></LI>
		<LI><A HREF="#$ini{$section} = {}; %{$ini{$section}} = %parameters;">$ini{$section} = {}; %{$ini{$section}} = %parameters;</A></LI>
		<LI><A HREF="#delete $ini{$section}{$parameter}">delete $ini{$section}{$parameter}</A></LI>
		<LI><A HREF="#delete $ini{$section}">delete $ini{$section}</A></LI>
		<LI><A HREF="#%ini = ();">%ini = ();</A></LI>
		<LI><A HREF="#parameter names">Parameter names</A></LI>
		<LI><A HREF="#section names">Section names</A></LI>
	</UL>

	<LI><A HREF="#diagnostics">DIAGNOSTICS</A></LI>
	<UL>

		<LI><A HREF="#@config::inifiles::errors">@Config::IniFiles::errors</A></LI>
	</UL>

	<LI><A HREF="#bugs">BUGS</A></LI>
	<LI><A HREF="#data structure">Data Structure</A></LI>
	<LI><A HREF="#author and acknowledgements">AUTHOR and ACKNOWLEDGEMENTS</A></LI>
	<LI><A HREF="#change log">Change log</A></LI>
</UL>
<!-- INDEX END -->

<HR>
<P>
<H1><A NAME="name">NAME</A></H1>
<P>Config::IniFiles - A module for reading .ini-style configuration files.</P>
<P>
<HR>
<H1><A NAME="synopsis">SYNOPSIS</A></H1>
<PRE>
  use Config::IniFiles;
  my $cfg = new Config::IniFiles( -file =&gt; &quot;/path/configfile.ini&quot; );
  print &quot;We have parm &quot; . $cfg-&gt;val( 'Section', 'Parameter' ) . &quot;.&quot;
        if $cfg-&gt;val( 'Section', 'Parameter' );</PRE>
<P>
<HR>
<H1><A NAME="description">DESCRIPTION</A></H1>
<P>Config::IniFiles provides a way to have readable configuration files outside
your Perl script.  Configurations can be imported (inherited, stacked,...), 
sections can be grouped, and settings can be accessed from a tied hash.</P>
<P>
<HR>
<H1><A NAME="file format">FILE FORMAT</A></H1>
<P>INI files consist of a number of sections, each preceded with the
section name in square brackets.  The first non-blank character of
the line indicating a section must be a left bracket and the last
nonblank character of a line indicating a section must be a right
bracket. The characters making up the section name can be any 
symbols at all. However section names must be unique.</P>
<P>Parameters are specified in each section as Name=Value.  Any spaces
around the equals sign will be ignored, and the value extends to the
end of the line. Parameter names are localized to the namespace of 
the section, but must be unique within a section.</P>
<PRE>
  [section]
  Parameter=Value</PRE>
<P>Both the hash mark (#) and the semicolon (;) are comment characters.
Lines that begin with either of these characters will be ignored.  Any
amount of whitespace may preceed the comment character.</P>
<P>Multiline or multi-valued parameters may also be defined ala UNIX 
``here document'' syntax:</P>
<PRE>
  Parameter=&lt;&lt;EOT
  value/line 1
  value/line 2
  EOT</PRE>
<P>You may use any string you want in place of ``EOT''.  Note that what
follows the ``&lt;&lt;'' and what appears at the end of the text MUST match
exactly, including any trailing whitespace.</P>
<P>
<HR>
<H1><A NAME="usage  object interface">USAGE -- Object Interface</A></H1>
<P>Get a new Config::IniFiles object with the <EM>new</EM> method:</P>
<PRE>
  $cfg = Config::IniFiles-&gt;new( -file =&gt; &quot;/path/configfile.ini&quot; );
  $cfg = new Config::IniFiles -file =&gt; &quot;/path/configfile.ini&quot;;</PRE>
<P>Optional named parameters may be specified after the configuration
file name.  See the <EM>new</EM> in the <STRONG>METHODS</STRONG> section, below.</P>
<P>Values from the config file are fetched with the val method:</P>
<PRE>
  $value = $cfg-&gt;val('Section', 'Parameter');</PRE>
<P>If you want a multi-line/value field returned as an array, just
specify an array as the receiver:</P>
<PRE>
  @values = $cfg-&gt;val('Section', 'Parameter');</PRE>
<P>
<HR>
<H1><A NAME="methods">METHODS</A></H1>
<P>
<H2><A NAME="new ( [option=>value ...] )">new ( [-option=&gt;value ...] )</A></H2>
<P>Returns a new configuration object (or ``undef'' if the configuration
file has an error).  One Config::IniFiles object is required per configuration
file.  The following named parameters are available:</P>
<DL>
<DT><STRONG><A NAME="item_%2Dfile_filename"><EM>-file</EM>  filename</A></STRONG><BR>
<DD>
Specifies a file to load the parameters from. This 'file' may actually be 
any of the following things:
<PRE>
  1) a simple filehandle, such as STDIN
  2) a filehandle glob, such as *CONFIG
  3) a reference to a glob, such as \*CONFIG
  4) an IO::File object
  5) the pathname of a file</PRE>
<P>If this option is not specified, (i.e. you are creating a config file from scratch) 
you must specify a target file using SetFileName in order to save the parameters.</P>
<P></P>
<DT><STRONG><A NAME="item_%2Ddefault_section"><EM>-default</EM> section</A></STRONG><BR>
<DD>
Specifies a section to be used for default values. For example, if you
look up the ``permissions'' parameter in the ``users'' section, but there
is none, Config::IniFiles will look to your default section for a ``permissions''
value before returning undef.
<P></P>
<DT><STRONG><A NAME="item_%2Dreloadwarn_0%7C1"><EM>-reloadwarn</EM> 0|1</A></STRONG><BR>
<DD>
Set -reloadwarn =&gt; 1 to enable a warning message (output to STDERR)
whenever the config file is reloaded.  The reload message is of the
form:
<PRE>
  PID &lt;PID&gt; reloading config file &lt;file&gt; at YYYY.MM.DD HH:MM:SS</PRE>
<P>Default behavior is to not warn (i.e. -reloadwarn =&gt; 0).</P>
<P></P>
<DT><STRONG><A NAME="item_%2Dnocase_0%7C1"><EM>-nocase</EM> 0|1</A></STRONG><BR>
<DD>
Set -nocase =&gt; 1 to handle the config file in a case-insensitive
manner (case in values is preserved, however).  By default, config
files are case-sensitive (i.e., a section named 'Test' is not the same
as a section named 'test').  Note that there is an added overhead for
turning off case sensitivity.
<P></P>
<DT><STRONG><A NAME="item_%2Dimport_object"><EM>-import</EM> object</A></STRONG><BR>
<DD>
This allows you to import or inherit existing setting from another 
Config::IniFiles object. When importing settings from another object, 
sections with the same name will be merged and parameters that are 
defined in both the imported object and the <EM>-file</EM> will take the 
value of given in the <EM>-file</EM>.
<P>If a <EM>-default</EM> section is also given on this call, and it does not 
coincide with the default of the imported object, the new default 
section will be used instead. If no <EM>-default</EM> section is given, 
then the default of the imported object will be used.</P>
<P></P></DL>
<P>
<H2><A NAME="val ($section, $parameter)">val ($section, $parameter)</A></H2>
<P>Returns the value of the specified parameter (<CODE>$parameter</CODE>) in section 
<CODE>$section</CODE>, returns undef if no section or no parameter for the given section
section exists.</P>
<P>If you want a multi-line/value field returned as an array, just
specify an array as the receiver:</P>
<PRE>
  @values = $cfg-&gt;val('Section', 'Parameter');</PRE>
<P>
<H2><A NAME="setval ($section, $parameter, $value, [ $value2, ... ])">setval ($section, $parameter, $value, [ $value2, ... ])</A></H2>
<P>Sets the value of parameter <CODE>$parameter</CODE> in section <CODE>$section</CODE> to 
<CODE>$value</CODE> (or to a set of values).  See below for methods to write 
the new configuration back out to a file.</P>
<P>You may not set a parameter that didn't exist in the original
configuration file.  <STRONG>setval</STRONG> will return <EM>undef</EM> if this is
attempted. See <STRONG>newval</STRONG> below to do this. Otherwise, it returns 1.</P>
<P>
<H2><A NAME="newval($section, $parameter, $value [, $value2, ...])">newval($section, $parameter, $value [, $value2, ...])</A></H2>
<P>Assignes a new value, <CODE>$value</CODE> (or set of values) to the 
parameter <CODE>$parameter</CODE> in section <CODE>$section</CODE> in the configuration 
file.</P>
<P>
<H2><A NAME="delval($section, $parameter)">delval($section, $parameter)</A></H2>
<P>Deletes the specified parameter from the configuration file</P>
<P>
<H2><A NAME="readconfig">ReadConfig</A></H2>
<P>Forces the configuration file to be re-read. Returns undef if the 
file can not be opened, no filename was defined (with the <CODE>-file</CODE>
option) when the object was constructed, or an error occurred while 
reading.</P>
<P>If an error occurs while parsinf the INI file the @Config::IniFiles::errors
array will contain messages that might help you figure out where the 
problem is in the file.</P>
<P>
<H2><A NAME="sections">Sections</A></H2>
<P>Returns an array containing section names in the configuration file.
If the <EM>nocase</EM> option was turned on when the config object was
created, the section names will be returned in lowercase.</P>
<P>
<H2><A NAME="sectionexists ( $sect_name )">SectionExists ( $sect_name )</A></H2>
<P>Returns 1 if the specified section exists in the INI file, 0 otherwise (undefined if section_name is not defined).</P>
<P>
<H2><A NAME="addsection ( $sect_name )">AddSection ( $sect_name )</A></H2>
<P>Ensures that the named section exists in the INI file. If the section already
exists, nothing is done. In this case, the ``new'' section will possibly contain
data already.</P>
<P>If you really need to have a new section with no parameters in it, check that
the name that you're adding isn't in the list of sections already.</P>
<P>
<H2><A NAME="deletesection ( $sect_name )">DeleteSection ( $sect_name )</A></H2>
<P>Completely removes the entire section from the configuration.</P>
<P>
<H2><A NAME="parameters ($sect_name)">Parameters ($sect_name)</A></H2>
<P>Returns an array containing the parameters contained in the specified
section.</P>
<P>
<H2><A NAME="groups">Groups</A></H2>
<P>Returns an array containing the names of available groups.
</P>
<PRE>

Groups are specified in the config file as new sections of the form</PRE>
<PRE>
  [GroupName MemberName]</PRE>
<P>This is useful for building up lists.  Note that parameters within a
``member'' section are referenced normally (i.e., the section name is
still ``Groupname Membername'', including the space) - the concept of
Groups is to aid people building more complex configuration files.</P>
<P>
<H2><A NAME="setgroupmember ( $sect )">SetGroupMember ( $sect )</A></H2>
<P>Makes sure that the specified section is a member of the appropriate group.</P>
<P>Only intended for use in newval.</P>
<P>
<H2><A NAME="removegroupmember ( $sect )">RemoveGroupMember ( $sect )</A></H2>
<P>Makes sure that the specified section is no longer a member of the
appropriate group. Only intended for use in DeleteSection.</P>
<P>
<H2><A NAME="groupmembers ($group)">GroupMembers ($group)</A></H2>
<P>Returns an array containing the members of specified $group. Each element
of the array is a section name. For example, given the sections</P>
<PRE>
  [Group Element 1]
  ...</PRE>
<PRE>
  [Group Element 2]
  ...</PRE>
<P>GroupMembers would return (``Group Element 1'', ``Group Element 2'').</P>
<P>
<H2><A NAME="writeconfig ($filename)">WriteConfig ($filename)</A></H2>
<P>Writes out a new copy of the configuration file.  A temporary file
(ending in .new) is written out and then renamed to the specified
filename.  Also see <STRONG>BUGS</STRONG> below.</P>
<P>
<H2><A NAME="rewriteconfig">RewriteConfig</A></H2>
<P>Same as WriteConfig, but specifies that the original configuration
file should be rewritten.</P>
<P>
<H2><A NAME="setfilename ($filename)">SetFileName ($filename)</A></H2>
<P>If you created the Config::IniFiles object without initialising from
a file, or if you just want to change the name of the file to use for
ReadConfig/RewriteConfig from now on, use this method.</P>
<P>Returns $filename if that was a valid name, undef otherwise.</P>
<P>
<H2><A NAME="setsectioncomment($section, @comment)">SetSectionComment($section, @comment)</A></H2>
<P>Sets the comment for section $section to the lines contained in @comment.
Each comment line will be prepended with ``#'' if it doesn't already have
a comment character (ie: if $line !~ m/^\s*[#;]/)</P>
<P>To clear a section comment, use DeleteSectionComment ($section)</P>
<P>
<H2><A NAME="getsectioncomment ($section)">GetSectionComment ($section)</A></H2>
<P>Returns a list of lines, being the comment attached to section $section. In 
scalar context, returns a string containing the lines of the comment separated
by newlines.</P>
<P>The lines are presented as-is, with whatever comment character was originally
used on that line.</P>
<P>
<H2><A NAME="deletesectioncomment ($section)">DeleteSectionComment ($section)</A></H2>
<P>Removes the comment for the specified section.</P>
<P>
<H2><A NAME="setparametercomment ($section, $parameter, @comment)">SetParameterComment ($section, $parameter, @comment)</A></H2>
<P>Sets the comment attached to a particular parameter.</P>
<P>Any line of @comment that does not have a comment character will be
prepended with ``#''.</P>
<P>
<H2><A NAME="getparametercomment ($sect, $parm)">GetParameterComment ($sect, $parm)</A></H2>
<P>Gets the comment attached to a parameter.</P>
<P>
<H2><A NAME="deleteparametercomment ($sect, $parm)">DeleteParameterComment ($sect, $parm)</A></H2>
<P>Deletes the comment attached to a parameter.</P>
<P>
<H2><A NAME="getparametereot ($section, $parameter)">GetParameterEOT ($section, $parameter)</A></H2>
<P>Accessor method for the EOT text (in fact, style) of the specified parameter. If any text is used as an EOT mark, this will be returned. If the parameter was not recorded using HERE style multiple lines, GetParameterEOT returns undef.</P>
<P>
<H2><A NAME="setparametereot ($section, $eot)">SetParameterEOT ($section, $EOT)</A></H2>
<P>Accessor method for the EOT text for the specified parameter. Sets the HERE style marker text to the value $EOT. Once the EOT text is set, that parameter will be saved in HERE style.</P>
<P>To un-set the EOT text, use DeleteParameterEOT ($section, $parameter).</P>
<P>
<H2><A NAME="deleteparametereot ($sect, $parm)">DeleteParameterEOT ($sect, $parm)</A></H2>
<P>Removes the EOT marker for the given section and parameter.
When writing a configuration file, if no EOT marker is defined 
then ``EOT'' is used.</P>
<P>
<H2><A NAME="delete">Delete</A></H2>
<P>Deletes the entire configuration file in memory.</P>
<P>
<HR>
<H1><A NAME="usage  tied hash">USAGE -- Tied Hash</A></H1>
<P>
<H2><A NAME="tie $ini, 'config::inifiles', (file=>$filename, [option=>value ...] )">tie $ini, 'Config::IniFiles', (-file=&gt;$filename, [-option=&gt;value ...] )</A></H2>
<P>Using <CODE>tie</CODE>, you can tie a hash to a <STRONG>Config::IniFiles</STRONG> object. This creates a new
object which you can access through your hash, so you use this instead of the 
<STRONG>new</STRONG> method. This actually creates a hash of hashes to access the values in 
the INI file. The options you provide through <CODE>tie</CODE> are the same as given for 
the <STRONG>new</STRONG> method, above.</P>
<P>Here's an example:</P>
<PRE>
  use Config::IniFiles;
</PRE>
<PRE>

  my %ini
  tie %ini, 'Config::IniFiles', ( -file =&gt; &quot;/path/configfile.ini&quot; );</PRE>
<PRE>
  print &quot;We have $ini{Section}{Parameter}.&quot; if $ini{Section}{Parameter};</PRE>
<P>Accessing and using the hash works just like accessing a regular hash and 
many of the object methods are made available through the hash interface.</P>
<P>For those methods that do not coincide with the hash paradigm, you can use 
the Perl <CODE>tied</CODE> function to get at the underlying object tied to the hash 
and call methods on that object. For example, to write the hash out to a new
ini file, you would do something like this:</P>
<PRE>
  tied( %ini )-&gt;WriteConfig( &quot;/newpath/newconfig.ini&quot; ) ||
    die &quot;Could not write settings to new file.&quot;;</PRE>
<P>
<H2><A NAME="$val = $ini{$section}{$parameter}">$val = $ini{$section}{$parameter}</A></H2>
<P>Returns the value of $parameter in $section.</P>
<P>Because of limitations in Perl's tie implementation,
multiline values accessed through a hash will <EM>always</EM> be returned 
as a single value with each line joined by the default line 
separator ($\). To break them apart you can simple do this:</P>
<PRE>
  @lines = split( &quot;$\&quot;, $ini{section}{multi_line_parameter} );</PRE>
<P>
<H2><A NAME="$ini{$section}{$parameter} = $value;">$ini{$section}{$parameter} = $value;</A></H2>
<P>Sets the value of <CODE>$parameter</CODE> in <CODE>$section</CODE> to <CODE>$value</CODE>.</P>
<P>To set a multiline or multiv-alue parameter just assign an 
array reference to the hash entry, like this:</P>
<PRE>
 $ini{$section}{$parameter} = [$value1, $value2, ...];</PRE>
<P>If the parameter did not exist in the original file, it will 
be created. However, Perl does not seem to extend autovivification 
to tied hashes. That means that if you try to say</P>
<PRE>
  $ini{new_section}{new_paramters} = $val;</PRE>
<P>and the section 'new_section' does not exist, then Perl won't 
properly create it. In order to work around this you will need 
to create a hash reference in that section and then assign the
parameter value. Something like this should do nicely:</P>
<PRE>
  $ini{new_section} = {};
  $ini{new_section}{new_paramters} = $val;</PRE>
<P>
<H2><A NAME="%hash = %{$ini{$section}}">%hash = %{$ini{$section}}</A></H2>
<P>Using the tie interface, you can copy whole sections of the 
ini file into another hash. Note that this makes a copy of 
the entire section. The new hash in no longer tied to the 
ini file, In particular, this means -default and -nocase 
settings will not apply to <CODE>%hash</CODE>.</P>
<P>
<H2><A NAME="$ini{$section} = {}; %{$ini{$section}} = %parameters;">$ini{$section} = {}; %{$ini{$section}} = %parameters;</A></H2>
<P>Through the hash interface, you have the ability to replace 
the entire section with a new set of parameters. This call
will fail, however, if the argument passed in NOT a hash 
reference. You must use both lines, as shown above so that 
Perl recognizes the section as a hash reference context 
before COPYing over the values from your <CODE>%parameters</CODE> hash.</P>
<P>
<H2><A NAME="delete $ini{$section}{$parameter}">delete $ini{$section}{$parameter}</A></H2>
<P>When tied to a hash, you can use the Perl <CODE>delete</CODE> function
to completely remove a parameter from a section.</P>
<P>
<H2><A NAME="delete $ini{$section}">delete $ini{$section}</A></H2>
<P>The tied interface also allows you to delete an entire 
section from the ini file using the Perl <CODE>delete</CODE> function.</P>
<P>
<H2><A NAME="%ini = ();">%ini = ();</A></H2>
<P>If you really want to delete <STRONG>all</STRONG> the items in the ini file, this 
will do it. Of course, the changes won't be written to the actual
file unless you call <STRONG>RewriteConfig</STRONG> on the object tied to the hash.</P>
<P>
<H2><A NAME="parameter names">Parameter names</A></H2>
<DL>
<DT><STRONG><A NAME="item_my_%40keys_%3D_keys_%25%7B%24ini%7B%24section%7D%7">my @keys = keys %{$ini{$section}}</A></STRONG><BR>
<DD>
<DT><STRONG><A NAME="item_while">while (($k, $v) = each %{$ini{$section}}) {...}</A></STRONG><BR>
<DD>
<DT><STRONG><A NAME="item_if">if( exists %{$ini{$section}}, $parameter ) {...}</A></STRONG><BR>
<DD>
</DL>
<P>When tied to a hash, you use the Perl <CODE>keys</CODE> and <CODE>each</CODE> 
functions to iteratively list the parameters (<CODE>keys</CODE>) or 
parameters and their values (<CODE>each</CODE>) in a given section.</P>
<P>You can also use the Perl <CODE>exists</CODE> function to see if a 
parameter is defined in a given section.</P>
<P>Note that none of these will return parameter names that 
are part if the default section (if set), although accessing
an unknown parameter in the specified section will return a 
value from the default section if there is one.</P>
<P>
<H2><A NAME="section names">Section names</A></H2>
<DL>
<DT><STRONG><A NAME="item_foreach">foreach( keys %ini ) {...}</A></STRONG><BR>
<DD>
<DT><STRONG>while (($k, $v) = each %ini) {...}</STRONG><BR>
<DD>
<DT><STRONG>if( exists %ini, $section ) {...}</STRONG><BR>
<DD>
</DL>
<P>When tied to a hash, you use the Perl <CODE>keys</CODE> and <CODE>each</CODE> 
functions to iteratively list the sections in the ini file.</P>
<P>You can also use the Perl <CODE>exists</CODE> function to see if a 
section is defined in the file.</P>
<P>
<HR>
<H1><A NAME="diagnostics">DIAGNOSTICS</A></H1>
<P>
<H2><A NAME="@config::inifiles::errors">@Config::IniFiles::errors</A></H2>
<P>Contains a list of errors encountered while parsing the configuration
file.  If the <EM>new</EM> method returns <STRONG>undef</STRONG>, check the value of this
to find out what's wrong.  This value is reset each time a config file
is read.</P>
<P>
<HR>
<H1><A NAME="bugs">BUGS</A></H1>
<UL>
<LI>
The output from [Re]WriteConfig/OutputConfig might not be as pretty as
it can be.  Comments are tied to whatever was immediately below them.
And case is not preserved for Section and Parameter names if the -nocase
option was used.
<P></P>
<LI>
No locking is done by [Re]WriteConfig.  When writing servers, take
care that only the parent ever calls this, and consider making your
own backup.
<P></P></UL>
<P>
<HR>
<H1><A NAME="data structure">Data Structure</A></H1>
<P>Note that this is only a reference for the package maintainers - one of the
upcoming revisions to this package will include a total clean up of the
data structure.</P>
<PRE>
  $iniconf-&gt;{cf} = &quot;config_file_name&quot;
          -&gt;{startup_settings} = \%orginal_object_parameters
          -&gt;{firstload} = 0
          -&gt;{nocase} = 0
          -&gt;{reloadwarn} = 0
          -&gt;{sects} = \@sections
          -&gt;{sCMT}{$sect} = \@comment_lines
          -&gt;{group}{$group} = \@group_members
          -&gt;{parms}{$sect} = \@section_parms
          -&gt;{EOT}{$sect}{$parm} = &quot;end of text string&quot;
          -&gt;{pCMT}{$sect}{$parm} = \@comment_lines
          -&gt;{v}{$sect}{$parm} = $value   OR  \@values</PRE>
<P>
<HR>
<H1><A NAME="author and acknowledgements">AUTHOR and ACKNOWLEDGEMENTS</A></H1>
<P>The original code was written by Scott Hutton.
Then handled for a time by Rich Bowen (thanks!),
It is now managed by Jeremy Wadsack,
with many contributions from various other people.</P>
<P>In particular, special thanks go to (in roughly chronological order):</P>
<P>Bernie Cosell, Alan Young, Alex Satrapa, Mike Blazer, Wilbert van de Pieterman,
Steve Campbell, Robert Konigsberg, Scott Dellinger, R. Bernstein,
Jeremy Wadsack, Daniel Winkelmann, Pires Claudio, and Adrian Phillips.</P>
<P>Geez, that's a lot of people. And apologies to the folks who were missed.</P>
<P>If you want someone to bug about this, that would be:</P>
<PRE>
        Jeremy Wadsack &lt;dgsupport at wadsack-allen dot com&gt;</PRE>
<P>If you want more information, or want to participate, go to:</P>
<PRE>
        <A HREF="http://sourceforge.net/projects/config-inifiles/">http://sourceforge.net/projects/config-inifiles/</A></PRE>
<P>Please send bug reports to <A HREF="mailto:config-inifiles-bugs@lists.sourceforge.net">config-inifiles-bugs@lists.sourceforge.net</A></P>
<P>Development discussion occurs on the mailing list
<A HREF="mailto:config-inifiles-dev@lists.sourceforge.net,">config-inifiles-dev@lists.sourceforge.net,</A> which you can subscribe
to by going to the project web site (link above).</P>
<P>This program is free software; you can redistribute it and/or 
modify it under the same terms as Perl itself.</P>
<P>
<HR>
<H1><A NAME="change log">Change log</A></H1>
<PRE>
     $Log: README,v $
     Revision 1.13  2001/12/20 16:09:02  wadg
     Update README

     Revision 2.27  2001/12/20 16:03:49  wadg
     - Fixed bug introduced in new valid file check where ';' comments in first lines were not considered valid
     - Rearranged some tests to put them in the proper files (case and -default)
     - Added more comment test to cover more cases
     - Fixed first two comments tests which weren't doing anything</PRE>
<PRE>
     Revision 2.26  2001/12/19 22:20:50  wadg
     #481513 Recognize badly formatted files</PRE>
<PRE>
     Revision 2.25  2001/12/12 20:44:48  wadg
     Update to bring CVS version in synch</PRE>
<PRE>
     Revision 2.24  2001/12/07 10:03:06  wadg
     222444 Ability to load from arbitrary source</PRE>
<PRE>
     Revision 2.23  2001/12/07 09:35:06  wadg
     Forgot to include updates t/test.ini</PRE>
<PRE>
     Revision 2.22  2001/12/06 16:52:39  wadg
     Fixed bugs 482353,233372. Updated doc for new mgr.</PRE>
<PRE>
     Revision 2.21  2001/08/14 01:49:06  wadg
     Bug fix: multiple blank lines counted as one
     Patched README change log to include recent updates</PRE>
<PRE>
     Revision 2.20  2001/06/07 02:49:52  grail
      - Added checks for method parameters being defined
      - fixed some regexes to make them stricter
      - Fixed greps to make them consistent through the code (also a vain
        attempt to help my editors do syntax colouring properly)
      - Added AddSection method, replaced chunk of ReadConfig with AddSection
      - Added case handling stuff to more methods
      - Added RemoveGroupMember
      - Made variable names more consistent through OO methods
      - Restored Unix EOLs</PRE>
<PRE>
     Revision 2.19  2001/04/04 23:33:40  wadg
     Fixed case sensitivity bug</PRE>
<PRE>
     Revision 2.18  2001/03/30 04:41:08  rbowen
     Small documentation change in IniFiles.pm - pod2* was choking on misplaces
     =item tags. And I regenerated the README
     The main reason for this release is that the MANIFEST in the 2.17 version was
     missing one of the new test suite files, and that is included in this
     re-release.</PRE>
<PRE>
     Revision 2.17  2001/03/21 21:05:12  wadg
     Documentation edits</PRE>
<PRE>
     Revision 2.16  2001/03/21 19:59:09 wadg
     410327 -default not in original; 233255 substring parameters</PRE>
<PRE>
     Revision 2.15  2001/01/30 11:46:48  rbowen
     Very minor documentation bug fixed.</PRE>
<PRE>
     Revision 2.14  2001/01/08 18:02:32  wadg
     [Bug #127325] Fixed proken import; changelog; moved</PRE>
<PRE>
     Revision 2.13  2000/12/18 07:14:41  wadg
     [Bugs# 122441,122437] Alien EOLs and OO delete method</PRE>
<PRE>
     Revision 2.12  2000/12/18 04:59:37  wadg
     [Bug #125524] Writing multiline of 2 with tied hash</PRE>
<PRE>
     Revision 2.11  2000/12/16 12:53:13  grail
     [BUG #122455] Problem with File Permissions</PRE>
<PRE>
     Revision 2.10  2000/12/13 17:40:18  rbowen
     Updated version number so that CPAN will stop being angry with us.</PRE>
<PRE>
     Revision 1.18  2000/12/08 00:45:35  grail
     Change as requested by Jeremy Wadsack, for Bug 123146</PRE>
<PRE>
     Revision 1.17  2000/12/07 15:32:36  grail
     Further patch to duplicate sections bug, and replacement of repeated values handling code.</PRE>
<PRE>
     Revision 1.14  2000/11/29 11:26:03  grail
     Updates for task 22401 (no more reloadsig) and 22402 (Group and GroupMember doco)</PRE>
<PRE>
     Revision 1.13  2000/11/28 12:41:42  grail
     Added test for being able to add sections with wierd names like section|version2</PRE>
<PRE>
     Revision 1.11  2000/11/24 21:20:11  rbowen
     Resolved SourceForge bug #122445 - a parameter should be split from its value on the first = sign encountered, not on the last one. Added test suite to test this, and put test case in test.ini</PRE>
<PRE>
     Revision 1.10  2000/11/24 20:40:58  rbowen
     Updated MANIFEST to have file list of new files in t/
     Updated IniFiles.pm to have mention of sourceforge addresses, rather than rcbowen.com addresses
     Regenerated README from IniFiles.pm</PRE>
<PRE>
     Revision 1.9  2000/11/23 05:08:08  grail
     Fixed documentation for bug 122443 - Check that INI files can be created from scratch.</PRE>
<PRE>
     Revision 1.1.1.1  2000/11/10 03:04:01  rbowen
     Initial checkin of the Config::IniFiles source to SourceForge</PRE>
<PRE>
     Revision 1.8  2000/10/17 01:52:55  rbowen
     Patch from Jeremy. Fixed &quot;defined&quot; warnings.</PRE>
<PRE>
     Revision 1.7  2000/09/21 11:19:17  rbowen
     Mostly documentation changes. I moved the change log into the POD rather
     than having it in a separate Changes file. This allows people to see the
     changes in the Readme before they download the module. Now I just
     need to make sure I remember to regenerate the Readme every time I do
     a commit.</PRE>
<PRE>
     1.6 September 19, 2000 by JW, AS
     * Applied several patches submitted to me by Jeremy and Alex.
     * Changed version number to the CVS version number, so that I won't
     have to think about changing it ever again. Big version change
     should not be taken as a huge leap forward.</PRE>
<PRE>
     0.12 September 13, 2000 by JW/WADG
     * Added documentation to clarify autovivification issues when 
     creating new sections
     * Fixed version number (Oops!)</PRE>
<PRE>
     0.11 September 13, 2000 by JW/WADG
     * Applied patch to Group and GroupMembers functions to return empty
     list when no groups are present (submitted by John Bass, Sep 13)</PRE>
<PRE>
     0.10 September 13, 2000 by JW/WADG
     * Fixed reference in POD to ReWriteFile. changes to RewriteConfig
     * Applied patch for failed open bug submitted by Mordechai T. Abzug Aug 18
     * Doc'd behavior of failed open
     * Removed planned SIG testing from test.pl as SIGs have been removed
     * Applied patch from Thibault Deflers to fix bug in parameter list
     when a parameter value is undef</PRE>
<PRE>
     0.09
     Hey! Where's the change log for 0.09?</PRE>
<PRE>
     0.08
     2000-07-30  Adrian Phillips  &lt;adrianp@powertech.no&gt;
</PRE>
<PRE>

     * test.pl: Fixed some tests which use $\, and made those that try
     to check a non existant val check against ! defined.</PRE>
<PRE>
     * IniFiles.pm: hopefully fixed use of $\ when this is unset
     (problems found when running tests with -w).  Similar problem with
     $/ which can be undefined and trying to return a val which does
     not exist. Modified val docs section to indicate a undef return
     when this occurs.</PRE>
<PRE>
     0.07
     Looks like we missed a change log for 0.07. Bummer.</PRE>
<PRE>
     0.06 Sun Jun 25, 2000 by Daniel Winkelmann
     * Patch for uninitialized value bug in newval and setval
</PRE>
<PRE>

     0.05 Sun Jun 18, 2000 by RBOW
     * Added something to shut up -w on VERSIONS
     * Removed unused variables</PRE>
<PRE>
     0.04 Thu Jun 15 - Fri Jun 16, 2000 by JW/WADG
     * Added support for -import option on -&gt;new
     * Added support for tying a hash
     * Edited POD for grammer, clarity and updates
     * Updated test.pl file
     * Fixed bug in multiline/single line output
     * Fixed bug in default handling with tie interface
     * Added bugs to test.pl for regression
     * Fixed bug in {group} vs. {groups} property (first is valid)
     * Fixed return value for empty {sects} or {parms}{$sect} in
     Sections and Parameters methods</PRE>
<PRE>
     0.03 Thu Jun 15, 2000 by RBOW
     * Modifications to permit 'use strict', and to get 'make test' working
     again.</PRE>
<PRE>
     0.02 Tue Jun 13, 2000 by RBOW
     * Fixed bug reported by Bernie Cosell - Sections, Parameters, 
     and GroupMembers return undef if there are no sections,
     parameters, or group members. These functions now return
     () if the particular value is undefined.
     * Added some contributed documentation, from Alex Satrapa, explaining
     how the internal data structure works. 
     * Set up a project on SourceForge. (Not a change, but worth
     noting).
     * Added Groups method to return a list of section groups.</PRE>
<PRE>
     0.01  Mon Jun 12, 2000 by RBOW
     Some general code cleanup, in preparation for changes to
     come. Put up Majordomo mailing list and sent invitation to
     various people to join it.</PRE>

</BODY>

</HTML>
