Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Prefer while() with an occasional redo {was Re: do/redo or for(;;): what's Kosher?}

by dave_aiello (Pilgrim)
on Jan 04, 2002 at 02:20 UTC ( #136120=note: print w/ replies, xml ) Need Help??


in reply to do/redo or for(;;): what's Kosher?

I primarily do Perl / SQL integration for a living, so I am partial to the while loop with an occasional redo. A lot of my programs require a "belt and suspenders" approach to data integrity, so I will often test for previous existance of a row or foreign key relationships before doing insert, update, or deletes.

For example, occasionally, a program will receive data from someplace else and conclude that an update needs to be done. However, the database does not contain the row in question. In that case, we change some aspect of the data so that an insert will take place, and perform a redo. This is by far the most intuitive way to perform a task like this.

OTOH, I don't like the "eternal-block" construct that you describe very much, unless you label the block and put in extensive comments. Maybe I'm too focused on my typical application, but I don't see very many benefits to doing this.

Dave Aiello
Chatham Township Data Corporation


Comment on Prefer while() with an occasional redo {was Re: do/redo or for(;;): what's Kosher?}

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (5)
As of 2014-08-30 18:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (293 votes), past polls