in reply to automatically choosing perl executable for CGI scripts

I don't want each of my CGI scripts to have #!/usr/bin/perl -wT at the top. I want this automatically done somehow. How can I do this?

I'm not clear on which of several problems you're trying to solve, so I'll assume that you don't want to hard-code the path in scripts that you intend to distribute, where they might break if they're installed on a box where Perl lives somewhere else.

The common way I see people addressing this is by writing an install script that first finds (or guesses, or asks for) the path to Perl, and then fixes up the #! line on each executable script component.

A alternate trick from the path-less-traveled is to use   #!./perl -wT then make a symbolic link the proper perl executable. This doesn't work for CGIs on Win32, but then neither does -T in the #! line. Some will consider this approach less than wise.

Replies are listed 'Best First'.
Re: Re: automatically choosing perl executable for CGI scripts
by ajt (Prior) on Nov 12, 2001 at 14:10 UTC
    This doesn't work for CGIs on Win32, but then neither does -T in the #! line.

    Actually -T works perfectly fine on Windows with Apache. As I discovered with IIS you have to hard code it else where.... Taint with Perl on NT/IIS.

    On Windows if you run IIS then the shebang is ignored, so you don't need it, and Apache can either follow the shebang (default) or use the Registry like IIS does.