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
MIME-Version: 1.0
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Content-Type: text/plain
Charset: utf8
Content-Disposition: inline
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 757
Download (untitled) / with headers
text/plain 757b
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-)
MIME-Version: 1.0
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Content-Disposition: inline
Charset: utf8
Content-Type: text/plain
Message-ID: <rt-3.6.HEAD-13950-1244453326-902.46721-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 967
Download (untitled) / with headers
text/plain 967b
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
MIME-Version: 1.0
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Content-Disposition: inline
Charset: utf8
Content-Type: text/plain
Message-ID: <rt-3.6.HEAD-13950-1244454186-492.46721-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 79
Fixed in Config-IniFiles-2.51 that was just uploaded to the CPAN. Thanks again.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.