On 9/15/06, hOURS <[EMAIL PROTECTED]> wrote:
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.
I assume you want this to execute this perl code and run independent of Perl being installed, not just obfuscate your code so people cant read the source? Did you try google? PAR may solve your probem, though I don't explicitly know what you need or why: http://par.wikia.com/wiki/Main_Page (wiki with links to CPAN) It looks like sourceforge has an open-source project for it named perlbin. http://perlbin.sourceforge.net/perlbin-0.01.html It also looks like people have had lots of trouble trying to get perlcc to work. Depending on how many times you will actually need to do this it may not be worth figuring out all your flags for perlcc. You might want to try what this person did: http://www.vdomck.org/blog/2005/09/23/perl-scripts-for-perl-less-people/ I know Ive seen commercial utilities to do this and that always puzzled me. Now I see why , the perlcc -B failed to compile my perl scripts as well. Researching it, indicates its experimental and was probably started as a path to turn the perl source into C. The few people I saw that had finally gotten it to work used a lot of flags.There are dependencies. ActiveState's Dev Kit has the ability to do this and a 21 day trial: http://www.activestate.com/Products/Perl_Dev_Kit/ perl2exe is the first one I think I ever saw ( commercial ) http://www.indigostar.com/perl2exe.htm HTH