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

Hi, I'm wondering if there's a way under windows that I can share simple PERL scripts with my coworkers who don't have PERL installed on their machines. Any way to bundle a run-time system or something like that? For what it's worth I'm using ActivePerl.... keith
  • Comment on How can I share PERL scripts with people who don't have PERL installed?

Replies are listed 'Best First'.
(tye)Re: How can I share PERL scripts with people who don't have PERL installed?
by tye (Sage) on Jun 28, 2001 at 00:41 UTC

    Make your C:/Perl (or whatever) directory shared, read-only with a share name of "Perl". Run your script through pl2bat (which is included with your copy of Perl). Edit the resulting *.bat file to replace the call to "perl" with a call to "//bigtiny/Perl/bin/perl" (you can use backslashes instead of forward slashes if you prefer).

    On a typical corporate Windows-based network, this will work, though a bit slowly. Get your coworkers hooked and then get them to install Perl to make things run faster.

    If you don't plan to run this on Win9x, then you can even have the *.bat file silently detect whether a local copy of Perl can be used. On Win9x, such a test is harder and may require spurious errors be displayed in some cases.

    Here is some untested sample code (I don't have Win9x handy):

    if "%OS%" == "Windows_NT" goto WinNT perl -x -S "%0" %1 %2 %3 %4 %5 %6 %7 %8 %9 if errorlevel 1 //bigtiny/perl/bin/perl -x -S "%0" %1 %2 %3 %4 %5 %6 % +7 %8 %9 goto endofperl :WinNT perl -x -S "%0" %* if NOT "%COMSPEC%" == "%SystemRoot%\system32\cmd.exe" goto endofperl if %errorlevel% == 9009 //bigtiny/perl/bin/perl -x -S "%0" %1 %2 %3 %4 + %5 %6 %7 %8 %9 if %errorlevel% == 9009 echo You do not have Perl in your PATH. if errorlevel 1 goto script_failed_so_exit_with_non_zero_val 2>nul goto endofperl

            - tye (but my friends call me "Tye")
Re: How can I share PERL scripts with people who don't have PERL installed?
by Anonymous Monk on Jun 27, 2001 at 22:36 UTC
    Check your license. Chances are you can distribute the Perl. If yes, make an installer (or use the one of Perl) to install Perl as your 'Runtime';-)
      Distributing Perl would definitely be a good idea, as it is free, and then they have the opportunity to change the scripts and run them as necessary.

      Depending on the nature of your scripts though, it is always a possibility to make them available to your coworkers via a web browser. Linux comes with Apache, and you can easily set up PWS or IIS on a Windows box, and just make your scripts accessible that way. They could just fire up their browser, and browse out to the perl scripts on your computer. Have fun,
      -Eric
Re: How can I share PERL scripts with people who don't have PERL installed?
by vladdrak (Monk) on Jun 28, 2001 at 07:49 UTC
    Get Perl2Exe, which will compile your script into a stanalone exe. If unregistered it displays a moderately annoying message after the code executes. I've used it on several occasions with AS 522 and it works well.

    http://www.indigostar.com/perl2exe.htm

    -Vlad
Re: How can I share PERL scripts with people who don't have PERL installed?
by clemburg (Curate) on Jun 28, 2001 at 13:15 UTC

    PerlApp from ActiveState is a good choice for this, if you can afford the cost of the Perl Development Kit.

    It's now also available for Non-Win32 platforms, e.g., Linux. It's a great thing for packaging stand-alone apps, IMHO.

    Christian Lemburg
    Brainbench MVP for Perl
    http://www.brainbench.com