Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

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

by Your Mother (Chancellor)
on Apr 18, 2014 at 17:54 UTC ( #1082794=note: print w/ replies, xml ) Need Help??


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

What tobyink said. An example where I always choose require and put it in subs/methods is the admin functions in webapps. Most of an applicationís users canít even see the admin code so there is no point in taking the hit on all requests. Plus you can be less worried about bringing in many/heavy/slow modulesĖ

use AllUserStuff; sub admin_stuff { require HugeExpensiveCodeRarelyEverCalled; require ManyMoreOtheSame; ... }

Just make sure to write good tests around it so you donít get the run time surprises you mentioned.


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

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (7)
As of 2015-07-30 11:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (271 votes), past polls