For some functions, that seems reasonable, but the return value of external processes doesn't seem like something that can be decided without knowing what the program is and why you're calling it.

Absolutely correct! However, I think there are some cases we can consider as always being exceptional. Dumping core, being killed by a signal, or failing to execute at all are almost never part of "normal" operation. A program that considers those "normal" is in itself exceptional.

If system() were to take an additional array ref argument at the beginning, what should it mean?

You raise a good point here. I've got a strong motivation to have the easy action be the right action. Adding a set of return values at the start (especially after one has written the code) is easy, but as you've noted it's not particularly obvious. I'd like it to be easy and obvious, if I can. Feedback and thoughts on this in particular would certainly be appreciated.

Once again, if you're in the mindset of "a safe system() replacement that prevents common mistakes", then I think your API is exactly right.

That's very reassuring. Thank-you. ;)

So I guess you can either (1) convince me of the error of my ways; (2) come up with another function name that implies what it's doing better (eg safe_system, but preferably shorter!), in which case I'll happily add it to IPC::Run::Simple; or (3) release your own module with a different name.

We may actually be heading down route #3 here, simply because it gets closer to the "simple-as-can-be" goal for the end-user, and I'm very hesitant to make any "simple" module more complex than it needs to be.


In reply to Re^4: 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!
  • 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.