Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

(tye)Re: use vs. require

by tye (Sage)
on Oct 20, 2000 at 00:25 UTC ( [id://37565]=note: print w/replies, xml ) Need Help??


in reply to use vs. require

Yes, by switching from use to require and import, you are reducing start-up time and probably reducing memory utilization (unless those modules are getting required elsewhere) until that chunk of code actually gets run.

The only thing you are losing is that the import doesn't happen until run time so any imported subroutines are not predeclared before the code that uses them is compiled. The practical consequences of this are that

  • you'll need to use parens to invoke the functions and
  • for any functions with prototypes, the prototypes will not be in effect for your code.

For most modules, those two consequence are pretty minor.

        - tye (but my friends call me "Tye")

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (3)
As of 2024-04-19 21:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found