Msg#: 3173752 posted 5:13 pm on Nov 30, 2006 (gmt 0)
I'm working on tuning my scripts and was curious if anyone had any experience or thoughts on the use of "require" as it relates to performance.
Some of my more heavily used scripts have up to 10 require statements in them (including random .pl modules/code). Do these .pl includes get cached automatically by Apache? Should I have any concerns about the performance of using "require"?
Msg#: 3173752 posted 6:47 pm on Dec 18, 2006 (gmt 0)
Good question. For all practical purposes, the require statement is just an enhanced form of do that makes it possible to more effectively load libraries and modules. Further, the use statement is an enhanced form of require that makes it possible to more effectively import modules.
If you simply want to modularize your code and you are highly concerned about efficiency, you could theoretically use a do statement to achieve nearly the same result as require. I would advise reading the perldocs before doing so, as there are important distinctions nonetheless.