Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^3: Was a module use'd or require'd? (CHECK?)

by Anno (Deacon)
on Aug 13, 2007 at 16:56 UTC ( #632269=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Was a module use'd or require'd? (CHECK?)
in thread Was a module use'd or require'd?

I think you are right. My method will tell whether a module was loaded before or after the main program was compiled, not whether it was a "use" or "require" statement that did the loading. It would be useless for the given purpose (about which I wans't quite clear when I wrote the reply).

Putting a subref on @INC looks like the best bet. It should be possible to tell the cases from another by looking at some levels of caller(). One problem here is to make sure you are always called. If someone unshifts new components onto @INC in front of you, you may never be for some modules.

Update: tie-ing @INC could help. It isn't magical, so tie should be no problem.

Anno


Comment on Re^3: Was a module use'd or require'd? (CHECK?)
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (8)
As of 2014-07-22 12:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (113 votes), past polls