On Tue, 08 Apr 2008 14:57:09 +0200, [EMAIL PROTECTED] wrote:

[please cc [EMAIL PROTECTED] to keep the discussion public]

> just a comment when using empty ini files. The function SectionExists is 
> not working on empty files. Gets the error message "Can't call method 
> "SectionExists" on an undefined value at test.pl line 7." The version is 
> still 2.38
> 
> the code run is:
> 
> #!/usr/bin/perl
> use Config::IniFiles;
> my $newCfg = new Config::IniFiles( -file => "empty.ini" );
> if($newCfg->SectionExists("FILE_IN 123")){
>         print "yes\n";
> } else {
>         print "no\n";
> }

Hm, looks like the same as a few days ago:
For empty files SetFileName() is necessary instead of passing the
filename to new(). The following works for me:

~~~~~
#!/usr/bin/perl
use Config::IniFiles;

my $newCfg = new Config::IniFiles();
$newCfg->SetFileName('newempty.ini');
if($newCfg->SectionExists("FILE_IN 123")){
        print "yes\n";
} else {
        print "no\n";
}
~~~~~

Cheers,
gregor

-- 
 .''`.   http://info.comodo.priv.at/ | gpg key ID: 0x00F3CFE4
 : :' :  debian: the universal operating system - http://www.debian.org/
 `. `'   member of https://www.vibe.at/ | how to reply: http://got.to/quote/
   `-    NP: Bob Dylan: Visions of Johanna

Attachment: signature.asc
Description: Digital signature

Reply via email to