Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Does #!perl -na -F/,/ work on Win NT?

by BrowserUk (Patriarch)
on Jul 26, 2002 at 12:38 UTC ( [id://185512]=note: print w/replies, xml ) Need Help??


in reply to Does #!perl -na -F/,/ work on Win NT?

Unfortunately, CMD.EXE does use the shebang line in your perl script. The Win32 mechanism for knowing which executable to use to process a given file is quite different. Being ASSOC and FTYPE; On my system these are set as follows:

C:\test>assoc .pl .pl=perl_script C:\test>ftype perl_script perl_script=e:\perl\bin\perl.exe -w %1 %*

Use HELP ASSOC|FTYPE for fulll definition of these commmands.

You will notice that I have modifes the ftype line and added the -w before any passed args. You could modify this on your system to have the -naF switches, but this would then be used for all Perl scripts run on that system which isn't very useful.

The second and probably best alternative is to use the ActiveSystems (assuming your using AS) supplied pl2bat command on your script, and the edit the top of it to have the switches you want.

Example: (additions in bold):

@rem = '--*-Perl-*-- @echo off if "%OS%" == "Windows_NT" goto WinNT
perl -x -S "%0" -na -F %1 %2 %3 %4 %5 %6 %7 %8 %9
goto endofperl :WinNT
perl -x -S %0 -na -F %*

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 CODE START HERE!!!

For further information for ActiveState installations read the AS docs at: A/S docs

(The above link assumes AS perl istalled in the default directories on your C: drive. Adjust as necessary on the addressline of your browser.

Edited bits per authors req. - dvergin 2002-07-29

Replies are listed 'Best First'.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://185512]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (6)
As of 2024-04-19 10:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found