sub a { print "foo\n"; } use B; # Fetch the internal object for this coderef my $obj = B::svref_2object(\&a); # Fetch the glob for that object my $gv = B::CV::GV($obj); print $gv->NAME;