Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

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]
[marto]: good morning all
[Corion]: Hi marto ;)
[Corion]: I hope you're well ;)
[marto]: running late today, get to work and people are just sitting around. "can't delete file, quota exceeded"
[Corion]: marto: Oy :-/
[Corion]: Ah, it's only "quota exceeded", not "filesystem full", so it's "merely" an administrative act to up the FS quota resp. inode quota
[Corion]: I've been on databases where I couldn't drop a table or delete rows because the DB was full. Not so much fun...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (7)
As of 2017-01-24 09:53 GMT
Find Nodes?
    Voting Booth?
    Do you watch meteor showers?

    Results (203 votes). Check out past polls.