On Tue Mar 06 20:51:07 2012,
http://dr1024.myopenid.com/ wrote:
Show quoted text> Currently, with the %s placeholder in message_layout, the subroutine
> name is always reported as Log::Handler::Levels::__ANON__.
>
> Should _get_c_sub in Handler/Pattern.pm be replaced by something like:
>
> sub _get_c_sub { (caller(3+$Log::Handler::CALLER_LEVEL))[3]//"" }
No. Log::Handler returns what caller returns.
---
use strict;
use warnings;
use Data::Dumper;
sub foo {
print Dumper([ caller(0) ]);
}
my $bar = sub {
print Dumper([ caller(0) ]);
};
&foo();
&$bar();
---
$VAR1 = [
'main',
'test.pl',
14,
'main::foo',
1,
undef,
undef,
undef,
1794,
'UUUUUUUUUUU',
undef
];
$VAR1 = [
'main',
'test.pl',
15,
'main::__ANON__',
1,
undef,
undef,
undef,
1794,
'UUUUUUUUUUU',
undef
];