get_code_info#

The package and the name a sub was defined under.

Synopsis#

use Sub::Identify qw(get_code_info);
my ($package, $name) = get_code_info(\&Foo::bar);   # ('Foo', 'bar')

What you get back#

The name of the sub’s package and its own name, from the glob it was defined in: an anonymous sub gives __ANON__, a sub imported under another name keeps the name it was defined with. Nothing for a non-reference, or for a sub that is still being compiled.