Re: exit status



"Jerry Adair" <jerry.adair@xxxxxxx> writes:

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> ));

How do you test the value of exit code?
[ What OS do you use? ]

It *works* as expected on my linux:
perl -e 'exit 2' ; echo $?

--
[pl2en Andrew] Andrzej Adam Filip : anfi@xxxxxxxxxxxx : anfi@xxxxxxxx
http://anfi.homeunix.net/
.



Relevant Pages

  • exit status
    ... I am attempting to return an error code from a Perl script. ... At first blush, ... exit(status(<blah blah blah>)); ...
    (comp.lang.perl.misc)
  • (no subject)
    ... I am having some problems building the arts-1.2.2,1 port. ... ".deps/mcopidl.Tpo"; exit 1; fi ... *** Error code 2 ...
    (freebsd-questions)
  • Problems installing arts-1.2.2,1 port
    ... I am having some problems building the arts-1.2.2,1 port. ... ".deps/mcopidl.Tpo"; exit 1; fi ... *** Error code 2 ...
    (freebsd-questions)
  • Re: exit status
    ... I am attempting to return an error code from a Perl script. ... it seemed easy with the exit() call. ... perldoc -f exit ... show us how you're calling the script and how you're getting the 'error code'. ...
    (comp.lang.perl.misc)
  • Re: Dynamically resizing a buffer
    ... a few calls to exit() in ancient code, so I can't claim I never use ... So do you prefer to handle errors by returning an error code, ... Indeed it could be argued that the second pointer is a different value ...
    (comp.lang.c)