Skip to Main Content
Perl Pocket Reference, 5th Edition
book

Perl Pocket Reference, 5th Edition

by Johan Vromans
July 2011
Intermediate to advanced content levelIntermediate to advanced
104 pages
2h 14m
English
O'Reilly Media, Inc.
Content preview from Perl Pocket Reference, 5th Edition

Special Subroutines

Special subroutines are user defined, but are called by Perl while processing the program. They can be used to change the order in which parts of a program are executed.

[ sub ] AUTOLOAD block

The code in block is executed when the program calls an undefined subroutine. $AUTOLOAD contains the name of the called subroutine, and @_ contains the parameters.

[ sub ] BEGIN block

The code in block is executed immediately when compilation of the block is complete.

[ sub ] CHECK block

Executed (in reverse order) when the compilation of the program finishes.

[ sub ] END block

Executed in reverse order when the Perl interpreter terminates. Inside the END blocks, $? contains the status with which the program is going to exit.

[ sub ] INIT block

Executed immediately before the Perl interpreter starts executing the program.

[ sub ] UNITCHECK block

Executed (in reverse order) when the compilation of the program unit finishes.

perlsub, perlmod.

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Perl Testing: A Developer's Notebook

Perl Testing: A Developer's Notebook

Ian Langworth, Chromatic
Perl Hacks

Perl Hacks

Chromatic, Damian Conway, Curtis Ovid Poe, Curtis (Ovid) Poe

Publisher Resources

ISBN: 9781449311186Errata Page