On 07/27/2012 06:08 PM, Jeremy Wadsack wrote:
> Ah, so it's failing in the hash copy.
>
> The reason Settings gets called twice is that it's looking for a default
> file because (I think) none was given on the command-line.
Right. It was Friday afternoon, that's my excuse.
> I actually don't recall how %{} works in terms of coercing something into a
> hash. It also may have changed since I last was really good at Perl. The
> thing is, %config isn't *really* a hash, it's a module that's tied to a
> hash to make it act like one.
So I wonder if something inside IniFiles object changed in or around
2.72 to make it not quite work as a hash.
> Still I think that `%statistics = %{$config{statistics}};` should work.
Here's the test case:
> use Config::IniFiles;
> use Data::Dumper;
> $Data::Dumper::Indent = 3;
> tie %hash, 'Config::IniFiles', ( -file => "/website/etc/analog/combined/ftp12.ini" ) ;
> print Dumper(\%hash);
> print "The source is " . $hash{statistics}{File_In};
> print "\n========================================\n";
> %copy = %{ $hash{ statistics } };
> print "The copy is " . $copy{File_In};
> print "\n========================================\n";
and the output:
> $ ./
simple.pl
> $VAR1 = {
> 'statistics' => {},
> 'navigation' => {},
> 'reports' => {},
> 'DIRECTORY' => {},
> 'QUICK' => {},
> 'graphs' => {},
> 'website' => {}
> };
> The source is /website/admin/logs/analog_output/ftp/ftp_2012.dat
> ========================================
> Use of uninitialized value in concatenation (.) or string at ./
simple.pl line 28.
> The copy is
> ========================================
Looks like a heisenbug to me: worked until I looked at it.