Home > Archive > PERL Miscellaneous > April 2005 > Return Codes in Perl: Question on implementing good patterns
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Return Codes in Perl: Question on implementing good patterns
|
|
| Matt_Pettis 2005-04-27, 3:58 pm |
| Hi,
I have some perl scripts that I am going to call in sucession from a
scheduling program (ESP, actually). I would like to control the flow
of executed scripts based on return codes from each of my perl scripts.
My question: does anybody have any good patterns of implementing this?
My thought is to maintain a global `$error_level' variable throughout
my script and then return its value in an END block. However, before I
go on and implement this, I'd like to hear about any
experiences/suggestions from experienced programmers on how they've
implemented this in perl.
Thanks,
Matt
| |
| John Bokma 2005-04-27, 3:58 pm |
| Matt_Pettis wrote:
> Hi,
>
> I have some perl scripts that I am going to call in sucession from a
> scheduling program (ESP, actually). I would like to control the flow
> of executed scripts based on return codes from each of my perl scripts.
>
> My question: does anybody have any good patterns of implementing this?
> My thought is to maintain a global `$error_level' variable throughout
> my script and then return its value in an END block. However, before I
> go on and implement this, I'd like to hear about any
> experiences/suggestions from experienced programmers on how they've
> implemented this in perl.
perldoc -f exit
--
John Small Perl scripts: http://johnbokma.com/perl/
Perl programmer available: http://castleamber.com/
Happy Customers: http://castleamber.com/testimonials.html
| |
| xhoster@gmail.com 2005-04-27, 3:58 pm |
| "Matt_Pettis" <Matthew.Pettis@gmail.com> wrote:
> Hi,
>
> I have some perl scripts that I am going to call in sucession from a
> scheduling program (ESP, actually). I would like to control the flow
> of executed scripts based on return codes from each of my perl scripts.
>
> My question: does anybody have any good patterns of implementing this?
I would implement in Perl, not ESP. I don't know how you would do it in
ESP.
> My thought is to maintain a global `$error_level' variable throughout
> my script and then return its value in an END block.
By "return" a value I assume you mean exit with that as its exit status,
right? Why not just call "exit" with the right value at the point you want
to exit?
> However, before I
> go on and implement this, I'd like to hear about any
> experiences/suggestions from experienced programmers on how they've
> implemented this in perl.
I generally find that an exit status has too little information capacity
to be very flexible. I'd check the STDOUT (or STDERR), rather than (or in
addition to) the exit status of each perl script. Then you can carefully
plan your allowed error messages as strings, not just tiny integers.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
|
|
|
|
|