Skip Menu |

This queue is for tickets about the Config-IniFiles CPAN distribution.

Report information
The Basics
Id: 46721
Status: resolved
Priority: 0/
Queue: Config-IniFiles

People
Owner: Nobody in particular
Requestors: fuzz [...] namm.de
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



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-)
On Mon Jun 08 04:16:28 2009, FUZZ wrote: Show quoted text
> 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-)
Hi! Thanks for the report. I'll deal with it shortly. Regards, -- Shlomi Fish
Fixed in Config-IniFiles-2.51 that was just uploaded to the CPAN. Thanks again.