in reply to Find the name of a CODEref

This should be equivalent:
use B; sub codename { my $coderef = shift; return unless ref $coderef eq 'CODE'; my $cv = B::svref_2object($coderef); return $cv->GV->NAME; }
But personally I would use Sub::Identify.
use Sub::Identify qw(sub_name); sub foo {} print sub_name(\&foo);