Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hello, How can i run a perl program in a system which doent have perl installed? I want to run a Perl program like a C "exe" file.
  • Comment on Running perl in a system that doesnt have perl..........

Replies are listed 'Best First'.
Re: Running perl in a system that doesnt have perl..........
by zby (Vicar) on Mar 31, 2003 at 11:50 UTC
    You need to package it together with the perl interpreter. Take a look at PAR.
Re: Running perl in a system that doesnt have perl..........
by nothingmuch (Priest) on Mar 31, 2003 at 11:53 UTC
    This is a question which can be broken up into several ones.

    I'll start with what is perl, and what is Perl within perl.

    perl is the Perl interpreter. It reads source code of the language Perl, and at the same go runs it. Compilation and runtime are fused into one process (kind of, but lets not get pesky), which is done over and over again.

    C (and other compiled languages) is turned into machine language - something the actual processor/operating system understands.

    In order to acheive what you want, you need to find a way to represent the code compiled into memory, by the interpreter, on disk, in a way that is understandable by the operating system. You can package the interpreter and the perl code into one binary executable using several development environments (i think the activestate suite supports something like that), or on unix, you can use CORE::dump, as documentat in perlfunc.

    You can also do something with the various B:: modules, but i feel i have no right telling you about them, as i haven't the faintest clue how to use them.

    The problem with running Perl without perl is that there are many dynamics between the two. It's hard to rethink of everything making a package, and thus the only natural way to do this is to include perl, and your Perl, in the same binary executable, in a way that the section which is perl reads data from the section which is your code, and runs it.

    I hope i've shed a bit of light, and am sorry for the confusion that i may have caused. Currently and simply it's impossible to run a Perl program without perl installed, somehow. There are various ways of getting around this, but none involve ignoring this completely. The B:: namespace is your friend, in this case, i think.

    Update: http://www.perldoc.com/perl5.8.0/bin/perlcc.html perldoc perlcc might be of use.

    -nuffin
    zz zZ Z Z #!perl
Re: Running perl in a system that doesnt have perl..........
by mce (Curate) on Mar 31, 2003 at 11:51 UTC
    I think you want PAR.
    ---------------------------
    Dr. Mark Ceulemans
    Senior Consultant
    IT Masters, Belgium
Re: Running perl in a system that doesnt have perl..........
by Basilides (Friar) on Mar 31, 2003 at 12:43 UTC
    i've been using app::packer to pack my programs into an .exe file, and it seems to work fine.
Re: Running perl in a system that doesnt have perl..........
by CountZero (Bishop) on Mar 31, 2003 at 13:54 UTC

    It is Perl Packer (based on PAR) that you are looking for.

    As it describes itself: pp creates standalone executables from Perl programs, using the compressed packager provided by PAR, and dependency detection heuristics offered by Module::ScanDeps. Source files are compressed verbatim without compilation. You may think of pp as "perlcc that works without hassle". :-)

    CountZero

    "If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law

Re: Running perl in a system that doesnt have perl..........
by deadkarma (Monk) on Mar 31, 2003 at 13:33 UTC
    Don't quite understand the question, although if you want to turn your perl program into a Windows 'exe' file you can look into either:

    perl2exe (http://www.perl2exe.com)
    PerlApp, which comes with ActiveState's Perl Dev Kit (http://activestate.com/Products/Perl_Dev_Kit/)

    Neither are free, although you can download and try them both out. I've had pretty good experiences with using them, and personally think PerlApp has a more features.

Re: Running perl in a system that doesnt have perl..........
by Anonymous Monk on Mar 31, 2003 at 22:10 UTC
    There is this note in the pp documentation that kinda kills the usage of PAR/pp on systems without Perl installed:

    Note that if your perl was built with a shared library, the 'Stand-alone setup' above will still need a separate perl5x.dll or libperl.so to function correctly. Patches to include a copy of libperl with the executable are most welcome.

    I've had luck with Perl2Exe for smaller applications. (or pointers to a static linked win32 version of Perl 5.6.1)

A reply falls below the community's threshold of quality. You may see it by logging in.