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: