This all started as a way to get around buying Perl2exe...or at least figuring out how it might work...

I wanted to run a Perl script from a workstation that does not have Perl installed (win2k), but I didn't want to have to use/buy Perl2exe (I am the only Perl advocate here, and I know my company will not spring for it). I thought of 2 options:

  1. Modify the stations path to point to a machine with Perl on it, or
  2. pack the minimum number of files that Perl needed to run the script and drop them on the workstation.

I chose the latter, and dropped the files on the PC (It was under 800k, how could I refuse?).

I picked the files I needed by trying to run perl.exe and the script in a new directory. The script would error out looking for different modules, and I just added in the modules into the directory as they were requested. Finally, the script did not error out, and I copied the directory to the other workstation.

It worked.

If your company uses WISE scripting (mine happens to)or even batch files you can pack the files into an executable (or bat) that copies the required files down, runs the Perl script, and deletes the files when it is done.

This was really slow going, so if anyone knows a faster method of knowing which files would be required by a script, I would be interested. Some of the files are easy to pick off, but I had to run a 3rd party app (WISE) to figure out some of the files (process.dll for example) used.

In case anyone is interested...

This Code...

use File::Copy; use win32::process; ######################### # MAIN # ######################### &checkem(); &runem(); ################################################## # IF THE FILE NOT EXIST, COPY FILES FROM SERVER # ################################################## sub checkem { if (-e 'c:/xsms2.txt'){ print "file exists\n"; }else{ copy('//server/d$/xsms2.txt',"c:/xsms2.txt") or die "$!\n"; print "file copied\n"; } } ################################################## # RUN THE PROCESS # ################################################## sub ErrorReport{ print Win32::FormatMessage( Win32::GetLastError() ); } sub runem(){ Win32::Process::Create($ProcessObj, 'c:/winnt/notepad.exe', 'notepad c:/xsms2.txt', 0, CREATE_NEW_CONSOLE, ".")|| die ErrorReport(); $ProcessObj->Suspend(); $ProcessObj->Resume(); $ProcessObj->Wait(INFINITE) }

Required these files:

Replies are listed 'Best First'.
RE: Minimum Perl, slightly Portable
by sproaticus (Initiate) on Sep 21, 2000 at 22:18 UTC
    The script actually uses some .dlls in the winnt directory, but I didn't list them because the workstation already had the dlls...

    Just In Case, the NT Resource Kit has a utility which will find all dlls a process will load. - jsproat

      Note that that tool only works for *.DLL files that the *.EXE has been linked against and won't catch *.DLL files that are loaded by DynaLoader when you use a module that has an XS (C code) component.

              - tye (but my friends call me "Tye")
RE: Minimum Perl, slightly Portable
by myocom (Deacon) on Sep 21, 2000 at 21:09 UTC

    The trial version of Perl2Exe also lists which modules and DLLs it's packing into the EXE, so you could conceivably run that just to get the list of files, then copy those files to your target workstation.

    Granted, it doesn't list perl.exe and its associated DLLs, only the ones that are needed for this particular script, but it's close, at least...and a darn sight faster than WISE, I'd have to guess...:-)

RE: Minimum Perl, slightly Portable
by clemburg (Curate) on Sep 30, 2000 at 16:27 UTC

    Sorry to dissent, but I would strongly advocate to buy the NT resource kit for these things. The PerlApp compiler will do what you want, and as an added bonus your Perl programs become respectable EXEs, which might help in a non-Perl-aware environment (I mean, who cares about the language in which an EXE was done - only geeks like us).

    Even if you spend the money from your own account, it is not much (about 100-200 US$ or so, if I remember correctly), and some hours of your work time easily add up to this amount.

    A strategy that has worked for me in the past is buying the kit in advance on my own account, prove that it helps to solve real problems, and then getting back to the company to make them buy the kit from me, so I get my money back.

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

RE: Minimum Perl, slightly Portable
by the_slycer (Chaplain) on Sep 26, 2000 at 20:42 UTC
    The other option for windows workstations is to install
    Perl on a network drive, and add the bin directory to
    the workstations path. I have tried this, it works.
    Perl2exe is always an option, but it makes for some darned
    big binaries.