# obtain CODEref name use B; sub coderef2name { my ($coderef) = @_; return unless UNIVERSAL::isa($coderef, "CODE"); my $obj = B::svref_2object($coderef); return $obj->GV->STASH->NAME . "::" . $obj->GV->NAME; }