Why? If you're using a simple -n/-p one-liner from the CLI, you can still do that with -T.
This
perl -pe 's/#.*$//'
now becomes
perl -Tpe 'BEGIN { $ENV{PATH} = "" } s/#.*$//'
Here's the deal:
- I agree that the one-liner still runs fine, but the shorthand notation is defeated.
- I agree that taint is a good thing, but I don't need its power & nit-pickiness for such a common, simple operation.
- I need to be able to whip up many safe read-only operations quickly. The current magic-diamond behavior is causing worries for me.
Yes, but it can be anticipated by the person running the program.
How? By checking the expanded filenames manually? I pass my filter to a co-worker in good spirit. "What, she ran it on a filename that ended with pipe-char "|"? Shame on her! for not knowing better that that means it will magically run a shell progra.... with 2-argument ope....."
OK, ok. I pass my
tainted filter to a co-worker in good spirit. "What, she got some Insecure dependency message? It only did half the files? Oh, she must have ran into a filename that ended with pipe-char "|". Shame on her! for not knowing better that that means Perl is in taint mode which checks for... among other things... so that it doesn't run a shell progra.... with 2-argument ope.... to get around this whole stinki...."
Eyes will glaze over at the explanations above, or ignorance is bliss. Either way, Perl gets a bad rep.
That really isn't any different from:
No, it
is different. Once again, your example is an
explicit call to
unlink. The magic-diamond
implicitly performs
arbitrary shell commands. "Arbitrary shell commands" is much worse than "fixed, predetermined perl function (unlink) call".
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.