Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Cost of passing function references

by RonW (Parson)
on Sep 16, 2015 at 21:31 UTC ( [id://1142251]=note: print w/replies, xml ) Need Help??


in reply to Cost of passing function references

Your reviewer is misinformed.

Perl code compiles as it is loaded. By the time the first executable line of code in a Perl program is run, the whole program has already been compiled.

Exceptions:

Code inside BEGIN blocks is run as soon as the enclosing block has been compiled.

Code inside modules included by use is run as soon as the module has been compiled. (use is run as soon as it compiled.)

Code inside modules included by require is not compiled until the require is executed.

Code inside files included by do is not compiled until the do is executed.

Code contained in strings is not compiled until evaluated by eval.

Subroutines loaded by the AUTOLOAD mechanism won't be compiled until your program calls them.

FYI, there are modules to facilitate autoloading, including AutoLoader and SelfLoader.

Update: Clarified use and added mention of do.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (8)
As of 2024-04-19 11:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found