It sounds to me like you should replace say "exit(1);" with die "some error message";. "die" prints an error message to STDERR and then the Perl program stops. If the "die" statement's string does not end in a \n, then Perl will report module and line number when "death occured". Normally this is of no interest to the user if the error message is good enough. But sounds like this tid-bit will help you debug a problem (extra info good for you).
The "normal" convention for a program to exit when it completes successfully is exit(0) or exit(with a non zero value) if program "bombed". That value (8 bits) is reported to the shell that invoked the program. I don't think that you want to mess around with starting a shell program that starts your Perl script and checks the return code.
Instead of exit(1), in Perl use: die "some error". Throwing exceptions has to do with OO stuff and OO is probably not what you have here in the legacy code. Do a search for the exit() lines and replace with 'die "error msg"' lines.
In reply to Re: Subroutine to indicate error condition
by Marshall
in thread Subroutine to indicate error condition
by kk2202
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |