Welcome to WebmasterWorld Guest from 22.214.171.124
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"?
Thanks for any advice.
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.