Most honorable monks, here is a question to prove your mastery of the symbol table and Perl's intestines:

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...


In reply to Can I find out which package a subroutine is from, originally? by nate

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.