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

Re: Best method for failure recovery?

by MZSanford (Curate)
on Sep 20, 2001 at 13:12 UTC ( [id://113552]=note: print w/replies, xml ) Need Help??


in reply to Best method for failure recovery?

This is a problem i have faced many times, and ended up writting some really odd code to reuse. But, most of the time, i found goto to be a fine solution. There will be people who will down vote this because the "dislike" goto, though i would guess they have never used it, and have only read that it is bad.
But, goto does require a moments thought. What i have done is something like the following (untested):
use Getopt::Long; my $RECOV_STEP = 'FTP_FILE'; my $optre = &GetOptions("-restart=s" => \$RECOV_STEP); if ($optre == 0) { print "Invalid Option Processing\n"; &usage(); } eval { goto $RECOV_STEP; }; if ($@) { die "Invalid Recovery Step '$RECOV_STEP'\n" }; FTP_FILE: { ### get data print "FTP Step Started\n"; }; LOAD_FILE: { ### load database with file print "Load Step Started\n"; }; CLEANUP: { ### archive data print "Cleanup Step Started\n"; }; sub usage { print "$0 -restart <STEP>\n"; }
I have worked with production operation groups for some time now, and have found that they seem to prefer named restart "steps" as opposed to numbers. <minirant>While this may be diffrent where you are, unless you want to be the person up as night on the phone telling them the numbers, i suggest named steps and a good document.</minirant>
my own worst enemy
-- MZSanford

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (4)
As of 2024-03-29 13:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found