Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Was a module use'd or require'd?

by Anonymous Monk
on Aug 13, 2007 at 09:42 UTC ( #632171=note: print w/ replies, xml ) Need Help??

Comment on Re: Was a module use'd or require'd?
Re^2: Was a module use'd or require'd?
by Ovid (Cardinal) on Aug 13, 2007 at 09:48 UTC

      I guess that Anonymous Monk wants you to explore stuffing subroutines into the DB package which is magical to Perl. At a cursory glance over perldebguts I at least find DB::postponed() which is called after a file is required but before it is executed, this might or might not help you, as you are quite unclear on what you actually want to do, except "differentiate between use and require", and your current solution does not tell me how you differentiate between the two with it.

      Update: Aristotle's idea of naming the module Package::CodeDumper makes it far more clear to me why you want to distinguish between use and require - you want to create code that looks "mostly" similar to the module as loaded from disk resp. as created by other means. This would be beneficial for caching of DBIx::Class or Class::DBI modules for example, and of course for debugging such dynamically created namespaces/packages.

        What I want to do is only unclear because the context is actually in the Devel::Recreate link I posted. Basically, I want to be able to do this:

        use Devel::Recreate 'recreate'; print recreate('Some::Package');

        From there, I want it to print out what Perl thinks the loaded module looks like. It's actually very tough to do and there are plenty of cases where it seems almost impossible. However, if I can just get a partial solution, that would be helpful for debugging.

        Cheers,
        Ovid

        New address of my CGI Course.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://632171]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (6)
As of 2014-09-01 08:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (299 votes), past polls