in reply to Code asks, in what file do I live?
Maybe you want this:
package Foo::Bar; sub test { my $pkg = __PACKAGE__; $pkg =~ s#::#/#g; $pkg .= '.pm'; print($INC{$pkg}, "\n"); }
It definitely has limitations (when package Foo::Bar isn't in or only in Foo/Bar.pm, for starters.
On second thought, caller provides some nice info:
package Pkg; sub test { local $,=", "; local $\="\n"; print(caller(0)); } test(); __END__ output ====== Pkg, script.pl, 10, Pkg::test, 1, , , , 0,
|
|---|