Re: exit status
- From: "J. Gleixner" <glex_no-spam@xxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 31 Mar 2006 10:48:37 -0600
Jerry Adair wrote:
Ok I'll keep with my vane of asking potentially obvious questions.
I am attempting to return an error code from a Perl script. At first blush, it seemed easy with the exit() call. But it doesn't work. Just out of frustration I tried a return() call, and I got the correct return code, albeit with an error message about returning from a non-subroutine.
The code I had was simple enough:
exit(status( <blah blah blah> ));
Maybe one of these will help:
perldoc -f die
perldoc -f exit
perldoc -f eval
perldoc -f system
It sounds like you should be using die or exit, so the issue seems to be
in how the program that's calling the script is detecting the error. It
should look at the exit status, not what's returned on STDOUT.
If you're still stuck, show us how you're calling the script and how you're getting the 'error code'. A simple one liner that calls the script/subroutine that has one line of code (die or exit) should be enough to figure it out.
.
- References:
- exit status
- From: Jerry Adair
- exit status
- Prev by Date: multi-line regular expression help
- Next by Date: Re: exit status
- Previous by thread: Re: exit status
- Next by thread: Re: exit status
- Index(es):
Relevant Pages
|