Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

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

by bart (Canon)
on Aug 14, 2007 at 10:40 UTC ( #632448=note: print w/replies, xml ) Need Help??

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

I had seen your post about Devel::Recreate on and I couldn't make heads nor tails of it, due to the bad (IMO) name, so I simply stopped reading. I thought you were just having fun with developing? Huh?

Now I see I have to read it as "re-create". Ah. (Perhaps name it "Devel::ReCreate", then, that'll be a bit clearer.)

Well, I'd explore two routes:

  1. Was the action (use or require) called using compile time or runtime? In the former, it must have been used, otherwise, it's likely to be required. Well, it's just a heuristic, good for 95% of all cases, because both use of BEGIN blocks and of eval can make this detection fail.
  2. Intercept the calls to import, which is just a plain (class) method, but called automatically. You can create one if none exists, or you could use Hook::LexWrap if it does.

I'm not saying this will solve all of your problems, but I thinks they are good options to explore.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://632448]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2018-06-23 14:31 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (125 votes). Check out past polls.