Perl cgi in taint mode - pass shebang switch to command line

2 December 2012, 21:14

Hiawatha version: 6.17.1
Operating System: Puppy Linux, Precise 5.4.1
Perl version: 5.14.2

I'm trying to script for users who may have any number of different scripts already installed.
Just adding -T to the shebang line:
#!/usr/bin/perl -T
- fails because perl requires the switch on the command line too.

It's possible to set it up globally a couple of different ways but that impacts other scripts - which may then fail.
I need to be able to set the switch on a script-by-script basis as required.

Currently hacking around by including as first line:
BEGIN {unless(${^TAINT}){exec $^X, '-T', $0}}
- but the reload is a big berformance hit.

Probably better to make it a generic switch pass as I dare say as soon as I have this one fixed there will be another along...

Thank you for an excellent server, just trying to make it even better.
This topic has been closed.