Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (2)
As of 2024-04-25 20:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found