Skip Menu |

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

Report information
The Basics
Id: 20680
Status: rejected
Priority: 0/
Queue: Config-IniFiles

People
Owner: Nobody in particular
Requestors: Vidar.Loken.Johannessen [...] virtek.no
Cc:
AdminCc:

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



Subject: Bug with Sections and GroupMembers methods
Date: Tue, 25 Jul 2006 17:15:56 +0200
To: bug-Config-IniFiles [...] rt.cpan.org
From: Vidar.Loken.Johannessen [...] virtek.no
Using Config::IniFiles version 2.38 on perl version 2.8.4. System is Debian version 3.1 (Linux commbox2006 2.6.8-2-386 #1 Tue Aug 16 12:46:35 UTC 2005 i686 GNU/Linux) When opening an empty ini file with Object Interface and using methods Sections or GroupMembers, this gives error message back and program quits. For GroupMembers method the error message is 'Can't call method "GroupMembers" on an undefined value at test.pl line 7.' For Sections method the error message is 'Can't call method "Sections" on an undefined value at test.pl line 7.' The file empty.ini do exist and program is able to read the content of file. I would think that they should return an empty array. Show quoted text
---- Start test script testing method GroupMembers ------ #!/usr/bin/perl use strict; use Config::IniFiles; my $cfg = Config::IniFiles->new( -file => "empty.ini"); my @Groups = $cfg->GroupMembers("test"); foreach my $group (@Groups) { print "$group\n"; } print "END\n";
--- End test script for method GroupMembers -------
---- Start test script testing method Sections ------ #!/usr/bin/perl use strict; use Config::IniFiles; my $cfg = Config::IniFiles->new( -file => "empty.ini"); my @Groups = $cfg->Sections(); foreach my $group (@Groups) { print "$group\n"; } print "END\n";
--- End test script for method Sections ------- Have also tested the same scripts on a different system: Config::IniFiles version: 1.8 Perl version: 5.6.0 System: Redhat 7.0 (Linux commbox 2.2.20 #2 Tue Dec 18 17:12:27 CET 2001 i686 unknown) Here it works as expected and returning an empty array. Best regards, Vidar L. Johannessen System developer and technical support Virtek Communication as Telephone: +47 33 03 05 35 Telefax: +47 33 03 05 31 E-mail: vidar.loken.johannessen@virtek.no Web Site: www.virtek.no
You should specify -allowempty in the constructor. Otherwise it will fail by design. Closing as rejected. Regards, Shlomi Fish