Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

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)}.


_($_=" "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}

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (8)
As of 2016-10-24 12:48 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (305 votes). Check out past polls.