Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

RE: Number of times I've used goto in Perl

by mcwee (Pilgrim)
on Apr 20, 2000 at 23:07 UTC ( #8246=note: print w/ replies, xml ) Need Help??


in reply to Number of times I've used goto in Perl

I'm one of the two monks who said that used GOTO once.

I don't remember what I used it for, but I do remember feeling deep shame.

PLease forgive my weakness-- I fall to me knees before my brethren and sistren and beg for mercy, understanding and absolution. I was a weak man then.

The Autonomic Pilot


Comment on RE: Number of times I've used goto in Perl
Re: RE: Number of times I've used goto in Perl
by Anonymous Monk on Nov 17, 2000 at 20:20 UTC
    Bless me father for I am about to sin.... I may have found a use for the goto but I thought I'd would consult with the elders prior to taking the plunge! I have one large perl script that drives a large data loading process every night. The script has a "main" subroutine that has roughly 30-40 steps - here's a snippet:

    sub main

    { ##>> 01001000:set output

    &set_output;

    ##>> 03001000:database up

    &database_up;

    ##>> 04001000:prior status

    &prior_status;

    ##>> 06001000:delete log records

    &delete_log_records; .........

    the "&" labels in "main" naturally call subroutines down in the body of the script. If our load process fails I want a way to "goto" the failure point in the script and continue processing by passing in a parameter that represents the step from which I'd like to continue. I can't think of another way of doing this with out rewriting the whole blessed script.

    Help O great ones!!

    Grasshopper

      Why not in main wrap blocks of calls in eval blocks and die when you hit errors?

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (6)
As of 2014-12-19 01:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (70 votes), past polls