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

Re^2: How to get the exit status and the output of the command launched in perl

by sunshine_august (Scribe)
on May 26, 2009 at 10:31 UTC ( #766183=note: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    [larry@august-dev perl]$ curl --max-time 3 http://someweb.org 2>&1
    curl: (6) name lookup timed out
    [larry@august-dev perl]$ echo $?
    6
    
  2. or download this
     #!/usr/bin/perl
     use strict;
    ...
     my $result = `curl --max-time 3 http://someweb.org 2>&1`;
     print "exit status: $?\n";
     print "result:\n", $result, "\n";
    
  3. or download this
    [larry@august-dev perl]$ ./foo.pl
    exit status: 1536
    result:
    curl: (6) name lookup timed out
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (8)
As of 2014-07-12 05:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (238 votes), past polls