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

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

by sundialsvc4 (Abbot)
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?

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (5)
As of 2018-04-20 19:31 GMT
Find Nodes?
    Voting Booth?