in reply to Re: Can I find out which package a subroutine is from, originally?
in thread Can I find out which package a subroutine is from, originally?

Dang, you so smoove!

Revised code as so:

use Devel::Peek "CvGV"; my $module = "Everything::Node::user"; #a bit of code clipped from the perl cookbook use no strict; local *stash; *stash = *{ "${module}::" }; #this is assuming the module has been "use"d -- which it has my @modfuncs; foreach(keys %stash) { my $glob = CvGV(\&{$stash{$_}}); $glob =~ s/^\*//; push (@modfuncs, $_) if defined &{ $stash{$_} } and $glob eq "$module\:\:$_"; } @modfuncs; #only the functions in my module!

And it works! Thanks...

--nate

  • Comment on Re: Re: Can I find out which package a subroutine is from, originally?
  • Download Code