My points were readability, maintainability and portability.

While Windows seem to ignore the path to the executable, Perl itself is indeed parsing the flags (though taint is special here - later more)

There is a fuzzy line were a short script is still in a league with one-liner from the command line where terseness pays off and a "real" program which needs at least mid-term maintenance.

"Hiding" important side-effects of in short flags is not a good idea in my book, they need to be explicitly shown!

And those provisory "scripts" tend to live longer than expected.

So whenever possible avoid shebang flags for code which needs to be maintained.

> How else would you expect to enforce taint mode, for example?

Granted, it's in the nature of taint that it's hard to manipulate.

But when I test -T or -t on the shebang on Win, it's not activated but only checked.

d:\tmp\pm>perl tst_taint.pl "-T" is on the #! line, it must also be used on the command line at ts +t_taint.pl line 1. d:\tmp\pm>

The same effect of exiting the current process can also be achieved by checking the read-only flag ${^TAINT}.

Putting this check into a pragma called use taint; (which I couldn't find yet) would be even better.

And this pragma could even go further, and re-exec the current script, with the -T flag set.

THOUGH ... the code for this pragma would need to be secured with special privileges, to avoid a backdoor for attackers...

I can't tell if this is bulletproof, but security is always relative anyway.

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery


In reply to Re^5: Command Switch -i prints to screen not file by LanX
in thread Command Switch -i prints to screen not file by BillKSmith

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.