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:
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:
The script actually uses some .dlls in the winnt directory, but I didn't list them because the workstation already had the dlls...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: Minimum Perl, slightly Portable
by sproaticus (Initiate) on Sep 21, 2000 at 22:18 UTC | |
by tye (Sage) on Sep 21, 2000 at 22:23 UTC | |
|
RE: Minimum Perl, slightly Portable
by myocom (Deacon) on Sep 21, 2000 at 21:09 UTC | |
|
RE: Minimum Perl, slightly Portable
by clemburg (Curate) on Sep 30, 2000 at 16:27 UTC | |
|
RE: Minimum Perl, slightly Portable
by the_slycer (Chaplain) on Sep 26, 2000 at 20:42 UTC |