Bug#400921: Config::IniFiles cannot be used against an empty file
gregor herrmann
gregor+debian at comodo.priv.at
Tue Apr 8 16:35:21 UTC 2008
On Tue, 08 Apr 2008 14:57:09 +0200, Vidar.Loken.Johannessen at virtek.no wrote:
[please cc 400921 at bugs.debian.org 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.alioth.debian.org/pipermail/pkg-perl-maintainers/attachments/20080408/95f09cd2/attachment.pgp
More information about the pkg-perl-maintainers
mailing list