planetscape has asked for the wisdom of the Perl Monks concerning the following question:
At the risk of sounding like The Boy Who Cried Wolf, I really do wonder if I have discovered a bug in Array::Compare.
When running the following code:
#!/usr/bin/perl -w use strict; use warnings; use Array::Compare; my $comp1 = Array::Compare->new; $comp1->Sep ('|'); $comp1->Skip ({3 => 1, 4 => 1}); $comp1->WhiteSpace (0); $comp1->Case (1); my $comp2 = Array::Compare->new ( Sep => '|', WhiteSpace => 0, Case => 1, Skip => {3 => 1, 4 => 1} ); my @arr1 = 0 .. 10; my @arr2 = 0 .. 10; if ($comp1->simple_compare (\@arr1, \@arr2)) { print "Arrays are the same\n"; } else { print "Arrays are different\n"; } if ($comp2->simple_compare (\@arr1, \@arr2)) { print "Arrays are the same\n"; } else { print "Arrays are different\n"; }
Under both 5.8 and 5.10 (thanks, CountZero!), I get the following warnings:
Use of uninitialized value $caller in string eq at /usr/lib/perl5/site +_perl/5.8/Array/Compare.pm line 328. Arrays are the same Use of uninitialized value $caller in string eq at /usr/lib/perl5/site +_perl/5.8/Array/Compare.pm line 328. Arrays are the same
When I run my program under the debugger, I note that the line preceeding (327) reads:
my ($pkg, $caller) = (caller(1))[0, 3];
and that after 327 is executed, $caller is undef.
Now, when you x (caller(1))[0, 3] within the debugger, obviously you get something a wee bit different than the program is seeing:
('DB', 'DB::eval')
However, x (caller(3))[0, 3] seems to return what I believe Array::Compare is expecting:
('main','Array::Compare::simple_compare')
It looks to me like something very weird is going on. Why isn't $caller set to Array::Compare::simple_compare? Why is $caller undef, therefore causing the "uninitialized value in string eq" as shown above?
Any insights will be greatly appreciated. Thanks in advance!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Bug in Array::Compare? (no, really)
by ysth (Canon) on Apr 19, 2009 at 08:54 UTC | |
|
Re: Bug in Array::Compare? (no, really)
by CountZero (Bishop) on Apr 19, 2009 at 10:04 UTC | |
by Anonymous Monk on Apr 19, 2009 at 17:05 UTC | |
by CountZero (Bishop) on Apr 19, 2009 at 17:47 UTC | |
|
Re: Bug in Array::Compare? (no, really)
by bart (Canon) on Apr 19, 2009 at 17:52 UTC | |
by ysth (Canon) on Apr 19, 2009 at 19:03 UTC | |
|
Re: Bug in Array::Compare? (no, really)
by ikegami (Patriarch) on Apr 19, 2009 at 09:37 UTC |