Re: Questions on porting Perl from Unix to Windows
by Frank Merrow other posts by this author
Jan 24 2008 12:10PM messages near this date
view in the new Beta List Site
Re: Questions on porting Perl from Unix to Windows
|
Re: Questions on porting Perl from Unix to Windows
> Second question:
> The UNIX #!/usr/bin/perl notation does not work with Perl scripts on
> Windows. How should I code if it is Unix I place "#!/usr/bin/perl"
> at the very first line of the script? But, I do not place it at the
> first line of code if it is not Unix? How should I do it?
This question is more complicated. I don't have time to research a
full answer. Plus because of some windows nonsense, some user can
run commands like this:
> somescript.pl
and some cannot . . . so . . . we wrap all our perl utilities as BAT files.
I offer this *.BAT stub as an answer we have come up with (not the
only or best - just "a" solution):
@rem = '--*-Perl-*--
@echo off
if "%OS%" == "Windows_NT" goto WinNT
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 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
@rem ';
#!perl
#line 15
Your Perl Code Here
__END__
I hope this helps.
Frank
_______________________________________________
Perl-Win32-Porters mailing list
Perl-Win32-Porters@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Thread:
Gary Yang
maddingue
Frank Merrow
Jenda Krynicky
Frank Merrow
Frank Merrow
|