Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: What are the advantages or disadvantages of "require" over "use"

by sundialsvc4 (Monsignor)
on Apr 18, 2014 at 12:49 UTC ( #1082753=note: print w/ replies, xml ) Need Help??


in reply to What are the advantages or disadvantages of "require" over "use"

Another thing which I consider to be quite important is that the use dependencies will be resolved as the software loads.   They will be static and unchanging throughout the lifespan of the process.   This is not true of require, which happens only when (and if) the statement is executed at runtime.

Therefore, I suggest that you use require (by means of UNIVERSAL::require) only when it is clearly called-for.   And, one fine example of where it is called-for can be found in, say, an RPC server such as RPC::Any, or some large web-site servers where some components are far more commonly used than others.   In these cases, it might be desirable and appropriate to “demand-load” portions of the software at runtime.


Comment on Re: What are the advantages or disadvantages of "require" over "use"

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (8)
As of 2014-08-22 22:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (168 votes), past polls