<?xml version="1.0" encoding="windows-1252"?>
<node id="900241" title="Re: Config::IniFiles , all methods return fail?" created="2011-04-19 18:09:59" updated="2011-04-19 18:09:59">
<type id="11">
note</type>
<author id="590906">
linuxer</author>
<data>
<field name="doctext">
&lt;p&gt;The module fails to create an object. As a result &lt;c&gt;$overlay&lt;/c&gt; is undefined.&lt;/p&gt;
&lt;p&gt;You should check the result of object creation and have a look at &lt;c&gt;@Config::IniFiles::errors&lt;/c&gt; upon failure.&lt;/p&gt;

&lt;code&gt;
my $cfg = Config::IniFiles-&gt;new( -file =&gt; 'test.ini' ) 
  or die "Failed to create Config::IniFiles object: @Config::IniFiles::errors\n";
&lt;/code&gt;

&lt;p&gt;&lt;b&gt;addendum:&lt;/b&gt; example:

&lt;code&gt;
0 linuxer@host /tmp $ cat /tmp/a.pl &amp;&amp; perl /tmp/a.pl
#! /usr/bin/perl
use strict;
use warnings;

use Config::IniFiles;


my $overlay = Config::IniFiles-&gt;new(-file =&gt; 'test.ini')
        or die "Failure: @Config::IniFiles::errors\n";

$overlay-&gt;newval("section1", "arg1", "anotherval");
$overlay-&gt;WriteConfig(-delta=&gt;1);

__END__

Failure: Empty file treated as error
255 linuxer@host /tmp $
&lt;/code&gt;</field>
<field name="root_node">
900239</field>
<field name="parent_node">
900239</field>
</data>
</node>
