Subject: | [PATCH] Does not correctly handle constants |
Hi there:
I'm forwarding this bug on behalf of a Debian user. The original text
(which follows), can be found at:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=539171
Look at this small program:
====
package MY;
use constant C1 => 0;
sub ok { }
package main;
sub ok { }
use Log::Trace warn => { 'AllSubs' => 1,
'Everywhere' => 1,
'Deep' => 1,
};
ok();
MY::ok();
====
When running it, it fails:
====
vdanjean@eyak:/tmp$ perl ./test.pl
Not a GLOB reference at /usr/share/perl5/Log/Trace.pm line 275.
BEGIN failed--compilation aborted at ./test.pl line 10.
vdanjean@eyak:/tmp$
====
If I patch /usr/share/perl5/Log/Trace.pm (near line 275)
# only wrap code references
+ next if (ref($symbols->{$typeglob}) eq 'SCALAR');
my $sub = *{$symbols->{$typeglob}}{CODE};
next unless (defined $sub and defined &$sub);
then, it works:
====
vdanjean@eyak:/tmp$ perl ./test.pl
main::ok( )
MY::ok( )
Config::DESTROY( Config, ... )
vdanjean@eyak:/tmp$
====
Note that I'm not sure there are not others bugs.
In particular, if I do not set 'Deep' => 1, the result should not change.
However, in this case, the programm runs (with or without my patch) but
other modules such as MY::ok are not traced anymore!
====
vdanjean@eyak:/tmp$ perl ./test.pl
main::ok( )
vdanjean@eyak:/tmp$
====