in reply to perl scripts executor on Win32

Hmmm, interesting, but I think that a C program is overkill (and it's no good to me as I don't have a C compiler...)
Using just the Win32 console you could also just do SET pathext=%pathext%;.PL and put all the directories you want to be able to execute from in your PATH environment variable.

Or you could use a simple batch file (this is just an example, very noddy, no error checking etc.etc.)

@echo off echo %0 if exist perl else goto :modules goto :EOF :modules if exist modules\ perl modules\ else goto :perl goto :EOF :perl if exist perl\ perl perl\ else goto :perl goto :EOF
If you saved this batch file as test.bat it would try to run in current, perl and modules directories, as per the C code above.


Replies are listed 'Best First'.
Re: Re: perl scripts executor on Win32
by Courage (Parson) on May 29, 2002 at 10:47 UTC
    May be I tried not enough, I did not succeed doing properly using your way.

    I tried using ASSOC, ftype in a different ways, but succeeded much less than 100%, mostly because I was not able to teach system about STDIN/STDERR/STDOUT redirections. (because something is going fishy on Win32 platforms:)

    Additionally, in my case I am not OS-specific (I think win95 will behave differently in respect of 'ftype' and 'assoc'), but, most importantly, I now able to use my script everywhere in our room at work, I do not need to remember whether this is set up properly on user's systems.

    As one more argument, after I compiled that program using both console and windows mode (two executables, one of them GUI, one console), I am free to choose appropriate mode, just copy appropriate executable and all is done.
    via associations I associate with perl.exe or wperl.exe, but not some this way and some - another way.

    BTW C is not that bad, you'll benefit when using both Perl and C :)

    Good luck and best wishes to you!