- publishing free software manuals
Perl Language Reference Manual
by Larry Wall and others
Paperback (6"x9"), 724 pages
ISBN 9781906966027
RRP £29.95 ($39.95)

Sales of this book support The Perl Foundation! Get a printed copy>>>

-f

Disable executing $Config{sitelib}/sitecustomize.pl at startup.

Perl can be built so that it by default will try to execute $Config{sitelib}/sitecustomize.pl at startup (in a BEGIN block). This is a hook that allows the sysadmin to customize how perl behaves. It can for instance be used to add entries to the @INC array to make perl find modules in non-standard locations.

Perl actually inserts the following code:

BEGIN {
    do { local $!; -f "$Config{sitelib}/sitecustomize.pl"; }
        && do "$Config{sitelib}/sitecustomize.pl";
}

Since it is an actual do (not a require), sitecustomize.pl doesn't need to return a true value. The code is run in package main, in its own lexical scope. However, if the script dies, $@ will not be set.

The value of $Config{sitelib} is also determined in C code and not read from Config.pm, which is not loaded.

The code is executed very early. For example, any changes made to @INC will show up in the output of `perl -V`. Of course, END blocks will be likewise executed very late.

To determine at runtime if this capability has been compiled in your perl, you can check the value of $Config{usesitecustomize}.

ISBN 9781906966027Perl Language Reference ManualSee the print edition