in reply to Re: Premature Error using CGI.pm
in thread Premature Error using CGI.pm

BTW - does anybody know why a shebang of:
#!/user/local/bin/perl
works on my machine? I have no /user directory, so I would expect an error, but I got none. Is something going on under the hood?

Assuming you're talking about Apache, it doesn't use the first line, but instead relies on file types that are set up in the configuration file to determine what type of file a request is, and so as long as it's named "something.pl", it doesn't matter to Apache what the first line is. Of course, if you run it from the command line, you'll get the unknown file error.

Replies are listed 'Best First'.
Re: Re: Re: Premature Error using CGI.pm
by a (Friar) on Feb 24, 2001 at 21:31 UTC
    Assuming, of course, you're on win32. I think both win32 and apache/win32 use the shebang line for command line options (-wT of course), but not to find the perl exe. On my unix (Solaris/Linii) boxen, a bad shebang path doesn't run, command line or cgi. On win32, it doesn't matter. Does YMV?.

    a

      On every platform, Perl uses the #! line to get options. But if Perl is the first one to get the -T option from the #!, then -T won't work (you'll get the "too late" error). Win32 doesn't use the #! at all. I've heard that Apache can be configured either way on Win32, but by default uses the #! line (and that agrees with my limited experience).

              - tye (but my friends call me "Tye")
        Okay, maybe I underspoke - perl on win32 uses the shebang line to get command line options, that is to say: a perl script on win32 w/ line 1 as:
        #!/usr/bin/perl -w
        doesn't care that /usr/bin/perl doesn't exist but, assuming you're doing:
        perl myscript_with_shebang.pl
        will use the '-w' for the script. However, -T will be 'too late' on win32.

        a