| 1 | package Class::Easy; | ||
| 2 | |||
| 3 | require B; | ||
| 4 | |||
| 5 | sub get_coderef_info ($) { | ||
| 6 | my ($coderef) = @_; | ||
| 7 | ref $coderef or return; | ||
| 8 | my $cv = B::svref_2object($coderef); | ||
| 9 | $cv->isa('B::CV') or return; | ||
| 10 | # bail out if GV is undefined | ||
| 11 | $cv->GV->isa('B::SPECIAL') and return; | ||
| 12 | |||
| 13 | return ($cv->GV->STASH->NAME, $cv->GV->NAME); | ||
| 14 | }; | ||
| 15 | |||
| 16 | 1; |