Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Data check or sleep

by benn (Vicar)
on Aug 26, 2003 at 12:50 UTC ( #286683=note: print w/replies, xml ) Need Help??


in reply to Data check or sleep

In cases like this, where the primary purpose is something straightforward (as stated in the question), I'd prefer to split up the code into 'obvious' subroutines, so that the main block of code looks something like this...
my $dbh = DBI->connect($connection_string); my $dbh2 = DBI->connect($connection_string2); while (1) { my $count = get_table_count($dbh); do_table_copy($dbh,$dbh2) if $count; sleep(15 * 60); }
Note that you don't need to sleep *only* if $count == 0 - if you perform the copy, presumably you're not going to want to bother checking again for another 15 minutes.

Cheers, Ben.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://286683]
help
Chatterbox?
[karlgoethebier]: LanX: no cuke?
[karlgoethebier]: btw, Churchill preferred 12 of these drinks instead of diet coke...
[LanX]: KGB that's amatter of perspective
[erix]: when you name is KirchenHuegel you want some compensation
LanX was googling for Kirchenhügel ... till he realized someone is translating Church-Hill to German... (slapping forhead)

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (7)
As of 2017-12-12 16:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What programming language do you hate the most?




















    Results (335 votes). Check out past polls.

    Notices?