Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Need Function for Timing out shell commands

by cdarke (Prior)
on Sep 15, 2011 at 07:40 UTC ( [id://926088]=note: print w/replies, xml ) Need Help??


in reply to Need Function for Timing out shell commands

I need the return value from the shell programm

You cannot use return from a main program, exit should be used instead (did you use warnings and strict?). Problem with exit though is that you can only return a number (between 0..255), not text. If you must return text:

Replace return $status with print $status
In the shell (Bash or Korn):
/home/fred$ result=$(perl gash.pl) /home/fred$ echo $result Timeout

Log In?
Username:
Password:

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

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

    No recent polls found