Subject: | $section->exists() does not pay attention to -nocase => 1 |
Given the following lowercase ini file:
[foo]
bar = 1
and this simple script
#!/usr/bin/perl
use Config::IniFiles;
my $config = Config::IniFiles->new( -file => 'Config-IniFiles.ini',
-nocase => 1 );
printf "exists FOO/BAR? %s\n", $config->exists( 'FOO', 'BAR') ? 'yes' :
'no' ;
printf "value of FOO/BAR: %s\n", $config->val( 'FOO', 'BAR');
the output *is*:
% ./Config-IniFiles.pl
exists FOO/BAR? no
value of FOO/BAR: 1
But the output should be:
exists FOO/BAR? yes
value of FOO/BAR: 1
The method 'exists()' should modified like this:
sub exists {
my ($self, $sect, $parm)=@_;
if ($self->{nocase}) {
$sect = lc($sect);
$parm = lc($parm);
}
return (exists $self->{v}{$sect}{$parm});
}
And everything should be fine. B-)