http://www.perlmonks.org?node_id=632174


in reply to Re: Was a module use'd or require'd?
in thread Was a module use'd or require'd?

That doesn't help. Can you elaborate?

Cheers,
Ovid

New address of my CGI Course.

Replies are listed 'Best First'.
Re^3: Was a module use'd or require'd?
by Corion (Patriarch) on Aug 13, 2007 at 09:57 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.