nate has asked for the wisdom of the Perl Monks concerning the following question:
I have a collection of modules in Everything::Node:: which carry functions for specific nodetypes -- (ie Everything::Node::user contains methods for user objects, Everything::Node::document for documents, etc). All of these modules "use Everything;" which allows them to access necessary functions.
Well, this works fine and dandy -- until I actually want to "see" into a specific module and figure out which subroutines are coming from Everything::Node::user. I can check the symbol table with something like this:
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) { push (@modfuncs, $_) if defined &{ $stash{$_} }; } @modfuncs; #my handy array of module functions
It gives me all the functions in the module, but it also gives me all the symbols that are exported from Everything.pm (or any other included modules).
All I want is the symbols that are defined by the specific module -- exclusive of exports from other modules. Is there any way I can find which package each sub originated from, so I can discriminate and only show the methods from Everything::Node::user?
Much appreciation for needed wisdoms,
--nate
PS for those of you familiar with Everything core, I'm trying to fix this bug from the "Gigantic Code Lister" in the "showchoicefunc" htmlcode...
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Can I find out which package a subroutine is from, originally?
by tye (Sage) on Jan 03, 2001 at 06:13 UTC | |
by nate (Monk) on Jan 03, 2001 at 07:22 UTC | |
Re: Can I find out which package a subroutine is from, originally?
by stephen (Priest) on Jan 03, 2001 at 06:22 UTC | |
by nate (Monk) on Jan 03, 2001 at 06:29 UTC |