SPUG: Buggy shebang-line parsing

Tim Maher tim at consultix-inc.com
Fri Jan 14 23:45:08 PST 2005


Fellow mongers,

I've found some serious bugs in recent Perl versions in the
parsing of non-trivial shebang lines, involving option clusters after
the first being disregarded if too many spaces precede the next ones,
and the -s option being ignored altogether, if it doesn't come first
in some cases.  For example:

	#! /usr/bin/perl -wlnaF'\t' -s 	# BAD!

	#! /usr/bin/perl -s -wlnaF'\t'	# GOOD!

I'd like to write a program to determine more precisely
which sequences do and don't work, before submitting my bug report.

But to automate that, I'd ideally like to
ask Perl itself which options it was using to run the
current script, rather than writing code to attempt
the exercising of all the requested options, and sense which
options were functioning correctly (or not).

In other words, I'm looking for something in Perl that's
analogous to the shell's $- variable, which reports the options
for the interpreter that are currently in effect.

Is there such a thing in Perl? If so, what/where/how, etc.

-Tim *---------------------------------------------------------------
-----------*
| Tim Maher, PhD (206) 781-UNIX (866) DOC-PERL (866) DOC-UNIX |
| tim(AT)Consultix-Inc.Com http://TeachMePerl.Com
| http://TeachMeUnix.Com |
*+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
+-+-+-+-+-*
|      Watch for my upcoming book: "Minimal Perl for UNIX/Linux
|      People" | Classes: 2/14: Minimal Perl 2/15: Hashes &
|      Arrays 2/16-18: Int. Perl |
*----------------------------------------------------------------
----------*



More information about the spug-list mailing list