Have I been missing this obviously simple module all this time, and if so, what is it called? (If not, then watch this space for a new module announcement.)
Oops, sorry. I skipped over the "watch this space" part when I read this thread, and went off to write the module (since I've wanted this many times too.) It's now uploaded to CPAN as
IPC::Run::Simple. If you want to take it over, let me know.
The module currently allows either:
use IPC::Run::Simple;
run("some", "command")
or die "command failed";
# better done as
use IPC::Run::Simple qw(:all);
run("some", "command")
or die "badness! $ERR";
which is what I normally want, or:
use IPC::Run::Simple qw(:Fatal);
my $exit_value = run(command => [ "some", "command" ],
allowed => [ 0, 1, 5 ]);
for what you want. Or, even closer to what you said:
use IPC::Run::Simple qw(:Fatal);
my $exit_value = run(command => "some_command",
allowed => [ 0, 1, 5 ]);
-
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.