Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

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

by shmem (Canon)
on Aug 14, 2007 at 13:32 UTC ( #632484=note: print w/ replies, xml ) Need Help??


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

IIUC the only distinction between use and require; import is the way they are triggered. Both perform OP_REQUIRE, but for use the parser calls Perl_utilize() in op.c, where a method call to import is faked, and the require and import calls are faked into a BEGIN block.

Other than inserting some hook right into Perl_utilize() and compile a development binary, I can see no way to reliably tell whether use Foo qw(bar) was called or BEGIN { require Foo; Foo->import qw(bar)}.

--shmem

_($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                              /\_¯/(q    /
----------------------------  \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}


Comment on Re: Was a module use'd or require'd?
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (14)
As of 2014-07-28 17:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (205 votes), past polls