Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
You do realize that to many people the phrase "X considered harmful" is, well, considered harmful? It's often used with the tongue and a cheek being very friendly to one another.

What's usually meant by such statements is that without due care, a fairly mundane and common practice can have unpleasant consequences. The prototypical case is "goto() considered harmful", which of course is silly at some level because most structured code simply abstracts it and does nothing to remove its proper use. The Djikstra article was much more conservative in its complaints about goto() than most who know it only by reference would guess. The author says that structured program flow was easier to follow, debug and formally prove. He does not say that careful use of goto() in some instances is bad, only that it was typical at the time to overuse and abuse the feature. Only improper use is the problem, as it is with system(). In fact, almost anything in our lives could be put to the same claim. It's not a perfect world we live in. Nothing's without risk, but we go on living. Overstating danger to get noticed is for news reporters and politicians, not programmers.

From the top of my head, "crosswalks considered harmful -- every intersection should have a bridge or tunnel", "kitchen knives considered harmful -- everyone should only eat things easily bitten apart, because you might cut a finger or hand", "firearms considered harmful -- if misused or handled recklessly, they can be deadly", "sex considered harmful -- if you're not careful you could catch something", and "tomatoes and spinach considered harmful -- if you raise, harvest, or handle most fruits and vegetables improperly, they might carry bacteria like salmonella or e. coli".

This last one has been a big deal recently in the US, actually, not because tomatoes are dangerous (and not even that salmonella is usually particularly dangerous where it's expected and properly mitigated). It's the improper handling that's the problem.Animals that carry salmonella in their meat should always be fully cooked, and animals that carry it in the intestines should be slaughtered and butchered responsibly (and their meat still cooked thoroughly on the surface if unsure). Tomatoes, not having intestines, should probably not be expected to carry an intestinal bacterial culture. With proper care, they don't.

Such is the issue with system(). There are risks, but most of them have to do with improper use and handling. Most of them can be either eliminated or mitigated with proper care. If its usefulness outweighs the risks, then use it. The risks rise more in certain situations, so more mitigation is needed. Perhaps in some cases there's too much risk, but in most of those calling any outside program should be strongly questioned in the first place.


In reply to Re: Use of system() considered harmful by mr_mischief
in thread Use of system() considered harmful by pc88mxer

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 having a coffee break in the Monastery: (2)
As of 2024-04-24 15:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found