Hi everyone,
I posed a question about compiling a while ago and got this response
(below). It occurred to me that some of the text looked like things one might
type into the window (a DOS window I believe it's called) that I run PERL
programs from. When I typed in "perldoc perlcompile" I got a ton of
information. The most interesting part was this:
To turn a Perl program into executable byte code, you can use 'perlcc' with the
'-b' switch:
perlcc b myperlprogram.pl
Very exciting - that's exactly what I want! So I whipped up a silly
little 2 line program to try as a test of this called bytecodetry.pl. I typed
in "perlcc -b bytecodetry.pl" and got the following results:
1) I saw this in the DOS window:
---------------------------------------------------------
Compiling bytecodetry.pl
---------------------------------------------------------
Making Bytecode (bytecodetry.plc) for bytecodetry.pl!
C:\Perl\bin\Perl.exe -IC:/Perl/lib -IC:/Perl/site/lib -I. -MB::Stash -c
bytecodetry.pl
2) Despite a blinking cursor on the next line, the computer became
almost entirely non-functional. A window called MS-DOS prompt appeared, which
said:
This program has performed an illegal operation and will be terminated.
Quit all programs, and then restart your computer.
If the program consistently encounters problems, click the Start button,
then select Help, Troubleshooting, and 'If you have trouble running MS-DOS
programs'.
I could respond with OK or get Details. The details were:
The program encountered a general protection exception
Fault location: 0028:0003
Interrupts in service: None
3) The computer made a file called bytecodetry.plc. That file had
one line:
#!C:\Perl\bin\Perl.exe_use ByteLoader 0.03;_
(Only the underscores weren't underscores, they were solid blocks, which
seem to represent returns, because that's what they became when I cut and
pasted it.) Despite a couple zeroes near the end there, that doesn't look
very binary to me. What's that all about?
Any help would be appreciated. Why is this illegal? Did I get byte
code? If so where is it?
Fred Kittelmann
hOURS wrote:
> Hi all,
Hello,
> I'd be interested in compiling programs I write in PERL. This is
> possible, right? I see occasional mention of such here and there
> but can't seem to find information on how it might be done. I
> assume one would need appropriate software, right, a compiler?
> Is such available open source?
perl *is* a compiler. :-)
perldoc perlcompile
perldoc -q "How can I compile my Perl program into byte code or C"
John
--
use Perl;
program
fulfillment
--
Fred Kittelmann
hOURS
215-551-1490
www.hoursystem.net
---------------------------------
Do you Yahoo!?
Get on board. You're invited to try the new Yahoo! Mail.