For Programmers: Free Programming Magazines  


Home > Archive > PERL Miscellaneous > July 2006 > FAQ 3.21 How can I compile my Perl program into byte code or C?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author FAQ 3.21 How can I compile my Perl program into byte code or C?
PerlFAQ Server

2006-07-31, 7:11 pm

This is an excerpt from the latest version perlfaq3.pod, which
comes with the standard Perl distribution. These postings aim to
reduce the number of repeated questions as well as allow the community
to review and update the answers. The latest version of the complete
perlfaq is at http://faq.perl.org .

--------------------------------------------------------------------

3.21: How can I compile my Perl program into byte code or C?

(contributed by brian d foy)

In general, you can't do this. There are some things that may work for
your situation though. People usually ask this question because they
want to distribute their works without giving away the source code, and
most solutions trade disk space for convenience. You probably won't see
much of a speed increase either, since most solutions simply bundle a
Perl interpreter in the final product (but see "How can I make my Perl
program run faster?").

The Perl Archive Toolkit ( http://par.perl.org/ ) is Perl's analog to
Java's JAR. It's freely available and on CPAN (
http://search.cpan.org/dist/PAR/ ).

The B::* namespace, often called "the Perl compiler", but is really a
way for Perl programs to p at its innards rather than create
pre-compiled versions of your program. However. the B::Bytecode module
can turn your script into a bytecode format that could be loaded later
by the ByteLoader module and executed as a regular Perl script.

There are also some commercial products that may work for you, although
you have to buy a license for them.

The Perl Dev Kit ( http://www.activestate.com/Products/Perl_Dev_Kit/ )
from ActiveState can "Turn your Perl programs into ready-to-run
executables for HP-UX, Linux, Solaris and Windows."

Perl2Exe ( http://www.indigostar.com/perl2exe.htm ) is a command line
program for converting perl scripts to executable files. It targets both
Windows and unix platforms.



--------------------------------------------------------------------

The perlfaq-workers, a group of volunteers, maintain the perlfaq. They
are not necessarily experts in every domain where Perl might show up,
so please include as much information as possible and relevant in any
corrections. The perlfaq-workers also don't have access to every
operating system or platform, so please include relevant details for
corrections to examples that do not work on particular platforms.
Working code is greatly appreciated.

If you'd like to help maintain the perlfaq, see the details in
perlfaq.pod.

--
Posted via a free Usenet account from http://www.teranews.com

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com