in reply to Re: Perl's __LINE__ off by 2 (Introspection)
in thread Perl's __LINE__ off by 2

here yet another approach to automatically introspect your source by using debugger flags - see $PERLDB:

(Crossposted at Reddit while PM was down)

BEGIN { $^P |= 0x400;}; use v5.12; use warnings; use Data::Dump; say "some code"; *DB::dbline = $::{ "_<" . __FILE__ }; ddx @DB::dbline;

OUTPUT:
perl /home/lanx/perl/pm/source_introspection.pl some code # source_introspection.pl:9: ( # undef, # undef, # "use v5.12; \n", # "use warnings;\n", # "use Data::Dump;\n", # "\n", # "say \"some code\";\n", # "\n", # "*DB::dbline = \$::{ \"_<\" . __FILE__ };\n", # "ddx \@DB::dbline;\n", # )

Cheers Rolf
(addicted to the Perl Programming Language :)
see Wikisyntax for the Monastery