'perlcc' is the frontend into the perl compiler. Typing 'perlcc a.p' compiles the code inside a.p into a standalone executable, and perlcc A.pm will compile into a shared object, A.so, suitable for inclusion into a perl program via "use A".

There are quite a few flags to perlcc which help with such issues as compiling programs in bulk, testing compiled programs for compatibility with the interpreter, and controlling.

Compiles 'one liners', in the same way that perl -e runs text strings at the command line. Default is to have the 'one liner' be compiled, and run all in one go (see -run); giving the -o flag saves the resultant executable, rather than throwing it away. Use '-argv' to pass arguments to the executable created.

Uses the optimized C backend (B::CC)rather than the simple C backend (B::C). Beware that the optimized C backend creates very large switch structures and structure initializations. Many C compilers find it a challenge to compile the resulting output in finite amounts of time. Many Perl features such as goto LABEL are also not supported by the optimized C backend. The simple C backend should work in more instances, but can only offer modest speed increases.

Show exactly what steps perlcc is taking to compile your code. You can change the verbosity level verbose_level much in the same way that the -D switch changes perl's debugging level, by giving either a number which is the sum of bits you want or a list of letters representing what you wish to see. Here are the verbosity levels so far :

If the -log tag is given, the default verbose level is 63 (ie: mirroring all of perlcc's output to both the screen and to a log file). If no -log tag is given, then the default verbose level is 7 (ie: outputting all of perlcc's output to STDERR).

NOTE: Because of buffering concerns, you CANNOT shadow the output of '-run' to both a file, and to the screen! Suggestions are welcome on how to overcome this difficulty, but for now it simply does not work properly, and hence will only go to the screen.

Tells perl to save the intermediate C code. Usually, this C code is the name of the perl code, plus '.c'; 'perlcode.p' gets generated in 'perlcode.p.c', for example. If used with the -e operator, you need to tell perlcc where to save resulting executables.

Most of the work of perlcc is done at the command line. However, you can change the heuristic which determines what is a module and what is a program. As indicated above, perlcc assumes that the extensions:

.p$, .pl$, and .bat$

indicate a perl program, and:

.pm$

indicate a library, for the purposes of creating executables. And furthermore, by default, these extensions will be replaced (and dropped) in the process of creating an executable.

To change the extensions which are programs, and which are modules, set the environmental variables:

PERL_SCRIPT_EXT PERL_MODULE_EXT

These two environmental variables take colon-separated, legal perl regular expressions, and are used by perlcc to decide which objects are which. For example:

setenv PERL_SCRIPT_EXT '.prl$:.perl$' prompt% perlcc sample.perl

will compile the script 'sample.perl' into the executable 'sample', and

setenv PERL_MODULE_EXT '.perlmod$:.perlmodule$'

prompt% perlcc sample.perlmod

will compile the module 'sample.perlmod' into the shared object 'sample.so'

NOTE: the '.' in the regular expressions for PERL_SCRIPT_EXT and PERL_MODULE_EXT is a literal '.', and not a wild-card. To get a true wild-card, you need to backslash the '.'; as in:

setenv PERL_SCRIPT_EXT '\.\.\.\.\.'

which would have the effect of compiling ANYTHING (except what is in PERL_MODULE_EXT) into an executable with 5 less characters in its name.

The PERLCC_OPTS environment variable can be set to the default flags that must be used by the compiler.

The PERLCC_TIMEOUT environment variable can be set to the number of seconds to wait for the backends before giving up. This is sometimes necessary to avoid some compilers taking forever to compile the generated output. May not work on Windows and similar platforms.

'perlcc' uses a temporary file when you use the -e option to evaluate text and compile it. This temporary file is 'perlc$$.p'. The temporary C code is perlc$$.p.c, and the temporary executable is perlc$$.

When you use '-run' and don't save your executable, the temporary executable is perlc$$