perl caller seems to be giving the "wrong" line around definition of coderef. I'd expect caller to flag line 8, but it's flagging line 12.
The deparser seems to give some quirky output, too.
Can anyone help me figure out what's going on here?
Thanks
> perl -v | head -n2
This is perl 5, version 16, subversion 2 (v5.16.2) built for x86_64-li
+nux
> cat -n program.pl
1 sub foo {
2 print join(", ", caller(0)) . "\n";
3 }
4
5 my %hash = (
6 A => 'foo',
7 B => {
8 C => foo(),
9 },
10 D => 'foo',
11 E => sub { return 1; },
12 F => 'foo',
13 G => 'foo',
14 );
15
16 my $foo = 'bar';
> perl program.pl
main, program.pl, 12, main::foo, 1, 1, , , 0, ,
> perl -MO=Deparse,-p,-l program.pl
#line 3 "program.pl"
sub foo {
#line 2 "program.pl"
print((join(', ', caller(0)) . "\n"));
}
#line 12 "program.pl"
(my(%hash) = ('A', 'foo', 'B', {'C', foo()}, 'D', 'foo', 'E', sub {
#line 11 "program.pl"
(return 1);
}
, 'F', 'foo', 'G', 'foo'));
#line 16 "program.pl"
(my $foo = 'bar');
program.pl syntax OK