Andrew McNaughton wrote:
On Sat, 29 Jan 2005, Chuck Swiger wrote:
[ ... ]
Well-behaved 3rd party scripts ought to start Perl via:

#! /usr/bin/env perl

...so long as /usr/local/bin is in the $PATH, they should still work fine.

I commonly use this approach, but I run into some problems with flags. Probably a simple gotcha someone can help with.

Eg the following useful constructs don't work:

#!/usr/bin/env perl -p
#!/usr/bin/env perl -T
#!/usr/bin/env perl -w

See "man perlrun" for some additional suggestions (and caveats), as it gives examples for passing -p to perl when invoked via /usr/bin/env or /bin/sh. You might also try putting a "--" between the 'env' and the 'perl' to indicate the end of command-line option processing to env.


It's possible that taint mode cannot be invoked this way (as that needs to be set very early on), though. There also seems to exist a PERL5OPT variable which could be set like so:

#!/usr/bin/env PERL5OPT='-w' perl

This should support -T, too, only it will zap any additional args specified afterwards (or so the docs say)...

--
-Chuck

_______________________________________________
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to