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

Re^3: system command

by tachyon-II (Chaplain)
on Jun 18, 2008 at 14:05 UTC ( [id://692708]=note: print w/replies, xml ) Need Help??


in reply to Re^2: system command
in thread system command

  1. So 2.pl might return anything.
  2. You can't do anything about that
  3. On success 2.pl returns WTF it feels like (see 1)
  4. And you want me to let *you* know the range of values that will be returned when the script is executed successfully and the range when it's failure

Sorry. Computer says no. Does not compute.

Maybe try backtics

$output = `perl 2.pl`; if ($output =~ m/some random error message/) { die "Computer says no"; }

Alternatively look up do and wrap that in an eval. This is archaic but is probably what you want.

eval{ do '2.pl' }; die "Aaaagh! $@" if $@;

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://692708]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (1)
As of 2024-04-24 15:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found