Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Re: quick question on modules

by LanX (Bishop)
on Feb 01, 2013 at 09:38 UTC ( #1016488=note: print w/replies, xml ) Need Help??

in reply to quick question on modules

Normally no!

Use means that a module-function import() is called at BEGIN-time.

Normally this function is inherited by Exporter module and does only an aliasing of imported functions.

And aliasing costs only some bytes, not enough to be discussed.

But a module author can chose to define his own import and do whatever he wants... so no general answer here.

Cheers Rolf

Replies are listed 'Best First'.
Re^2: quick question on modules
by Corion (Pope) on Feb 01, 2013 at 09:47 UTC

    A great counterexample is POSIX:

    Q:\>perl -MPOSIX -wle "print for grep {$_ =~ /$$/} `tasklist`" perl.exe 5508 Console 0 3.936 +K Q:\>perl -MPOSIX=strftime -wle "print for grep {$_ =~ /$$/} `tasklist` +" perl.exe 4904 Console 0 3.672 +K exports all its functions and constants by default, which costs 300K memory, while importing just the few needed functions reduces the amount of memory spent.

    tl; dr - just like you said, no general answer here.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (3)
As of 2018-05-23 17:12 GMT
Find Nodes?
    Voting Booth?