I'm trying to use B::Deparse's output to find out where a subroutine is defined. It seems the line numbers indicate where the subroutine code ends but not where it starts.
Here is my test program:
use strict;
use warnings;
#3
sub foo () {
print("F1");
print("F2");
print("F3");
}
#9
And here is "perl -MO=Deparse,-l" output:
#line 8 "foo.pl"
sub foo () {
use warnings;
use strict 'refs';
#line 5 "foo.pl"
print 'F1';
#line 6 "foo.pl"
print 'F2';
#line 7 "foo.pl"
print 'F3';
}
foo.pl syntax OK
So the "#line" before the sub declaration is in fact the end of the sub, not its begin.
How can I find out where it really starts knowing that pragmas like "strict" do change how the sub is rendered?