Perl Compilation by hcw25539

VIEWS: 24 PAGES: 2

									                                   Perl Compilation

        In the LCB group we do have a copy of ActiveState’s (www.activestate.com)’s Perl
Compiler.
        Perl is an interpreted language, which usually runs by the command line, with the
interpreter being needed to run the perl script. So, you have to type perl script.pl, which
means the user of your script has to have perl installed on their system.
        To make perl files more portable, the Perl Compiler converts perl scripts into
standalone executables. This means that you no longer need the perl interpreter to run
your perl scripts, instead you just can run the perl executable by itself. Once compiled,
the perl script will no longer end with a .pl, but with a .exe.
        This may not improve speed, since although it is compiling it, the compiler
actually has to fit large sections of the perl interpreter and perl library code into your
executable.
        To run the Perl Compiler, you have to go to a Windows NT machine. The only
Windows machine currently running is in 342 and is called Halifax.
        Before running the Perl Compiler, if you have any libraries in your files (like Tk
for example), you have to individually list every library component in your script. For
example, you can’t just list
        Use Tk;

But should list all the parts:

        Use Tk;
        Use Tk::Frame;
        Use Tk::Button;
        Use Tk::CheckButton;
        Use Tk::Label
        and so on…

       Once this has been done, you’re ready to compile. The Perl Compiler has many
options, but I’ve found this is one works:

Go to D:\Perl\Bin on Halifax:

The type:

PerlApp -v myScript.pl -add=My::Library -e MyExecutable.exe -g –f

        Where myScript.pl is the name of your script, like multimrc.pl, My::Library is the
name of one your libraries, like Tk::Label, and MyExecutable.exe is the name of one
what you want to call your executable file, like multimrc.exe.
        You might want to run that with the directory structure of PerlApp in front of it,
or with the directory structure of your scripts in front of them.
        Type PerlApp –h | more for explanation and help.

								
To top