Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??

I'm specifically after a module that makes it dead simple to call system() for the most simple cases, and still get proper error-handling. What I essentially want is Fatal for system().

That means we're not capturing output, and we're not doing complicated pipelines. If you want a module that handles all that and more, then there's IPC::Run. It's complete, but it's not simple.

What's proper-error handling for the most simple cases? Well, if your program never started, that's an error. If it got killed by a signal or dumped core, then you probably didn't expact that, so that's an error too. If it returns a non-zero exit status, then that's also an error unless you pass an argument to say otherwise.

As for efficiency, this is a clear case where correctness should easily trump speed. system() is slow to begin with, since there's all that fork-and-exec'ing going on under the hood. Having error-checking that's hard to get wrong (ie, exceptions), and having meaningful error messages (instead of die "Ooops! $! - $?") is going to be much better for correctness and programmer productivity in the long run.

This is very much a case of wanting something that makes simple things easy. We've already got many ways of making the hard things possible.

Cheerio,


In reply to Re^2: Modules which improve system() ? by pjf
in thread Modules which improve system() ? by pjf

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!
  • 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, 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, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            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.
  • Log In?
    Username:
    Password:

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

    How do I use this? | Other CB clients
    Other Users?
    Others imbibing at the Monastery: (16)
    As of 2014-10-30 14:51 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      For retirement, I am banking on:










      Results (208 votes), past polls