Click here to get back home

Bug with hash time & multilines in Config::IniFiles v2.38 ?

 HomeNewsGroups | Search | About
 comp.lang.perl.modules    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Bug with hash time & multilines in Config::IniFiles v2.38 ? Yves Martin 01-26-2005
Posted by Yves Martin on January 26, 2005, 9:53 am
Please log in for more thread options

Hello,

I have written a code using a Config::IniFiles object tied to a hash and it
was working well on my dev machine with revision 2.27 of the module.

When deploying my code on a machine with revision 2.38 - the multiline value
are not returned correctly according to the way I understand the
documentation. So I wrote the following test case:

#!/usr/bin/perl -w

use strict;
use Config::IniFiles;

my $configFile = "conf.ini";

open(CONF, ">" . $configFile);
print CONF <<EOF;
[Test]
multiline=<<EOT
multi/value1
multi/value2
EOT
singleline=4590
EOF
close(CONF);

my $expectedMulti = "multi/value1nmulti/value2";

my $configNew = new Config::IniFiles(-file => $configFile);

my $resultNew = $configNew->val('Test','multiline');
if ($expectedMulti ne $resultNew) {
print "NEW: Result ' ", $resultNew, "' differs from expected '",
$expectedMulti, "'n";
}


my %configTie;
tie %configTie, 'Config::IniFiles', (-file => $configFile);

my $resultTie = $configTie;
if ($expectedMulti ne $resultTie) {
print "TIE: Result '", $resultTie, "' differs from expected '",
$expectedMulti, "'n";
}

Is it really a bug ? Or I misunderstood the documentation ?
Regards
--
Yves Martin


Posted by Thomas Kratz on January 26, 2005, 12:23 pm
Please log in for more thread options
Yves Martin wrote:
> Hello,
>
> I have written a code using a Config::IniFiles object tied to a hash and it
> was working well on my dev machine with revision 2.27 of the module.
>
> When deploying my code on a machine with revision 2.38 - the multiline value
> are not returned correctly according to the way I understand the
> documentation. So I wrote the following test case:

[code snipped]

You are right. Looking at IniFiles.pm you will find the following entry in
the revision history:

Revision 2.28 2002/07/04 03:56:05 grail
Changes for resolving bug 447532 - _section::FETCH should return
array ref for multiline values.

So you'll get a reference to an array holding the values since 2.28. It
seems they forgot to change the pod as well as the code :-(

You could file a bug report at:

http://rt.cpan.org/NoAuth/Bugs.html?Dist=Config-IniFiles

Thomas


--
$/=$,,$_=<DATA>,s,(.*),$1,see;__END__
s,^(.*
Similar ThreadsPosted
[ANNOUNCE] Config::Model - Framework for semantic validation of config data March 20, 2006, 10:07 am
Modules for hash functions? (ie, common algorithms for computing hash keys, not manipulating perl hashes) August 26, 2006, 7:08 pm
Overriding $Config? November 4, 2005, 4:50 pm
Hash July 14, 2006, 5:27 pm
ANNOUNCE: Config::Scoped August 3, 2004, 12:35 pm
New release of Config-Model July 24, 2006, 8:20 am
New release of Config::Model v 0.612 August 4, 2007, 11:43 am
New version of Config::Model (v0.615) November 16, 2007, 7:43 am
Is a hash the best method to do this? December 24, 2007, 1:23 pm
Config::Any fails tests on install February 24, 2007, 2:49 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap