Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^2: Infinite Loop Question

by joeymac (Acolyte)
on Nov 08, 2011 at 19:34 UTC ( [id://936862]=note: print w/replies, xml ) Need Help??


in reply to Re: Infinite Loop Question
in thread Infinite Loop Question

Thanks for the quick response! There are no alarms coded in the script. Your second suggestion is something that I am not sure about. I will look into this. The third suggestion I believe I accounted for with a second nested infinite loop that tries to reconnect (using Net::FTP) until connection is reestablished. It then exits this loop with a last statement and returns to the overall infinite loop.

for(;;) {... my $host = something; my $ftp = Net::FTP->new($host, Timeout => 30); if (defined($ftp)) { my $TODAY = time; print LOG "Established ftp connection with $host\n"; print LOG "at: ", scalar(localtime($TODAY)), "\n"; } else { for (;;) { print LOG "Unable to make connection with $host\n"; print LOG "Try to reconnect in 5 secs to $host\n"; sleep 5; my $ftp = Net::FTP->new($host, Timeout => 60); if (defined($ftp)) { my $TODAY = time; print LOG "Established ftp with $host\n"; print LOG "at: ", scalar(localtime($TODAY)), "\n"; last; } } } ...}

Replies are listed 'Best First'.
Re^3: Infinite Loop Question
by elTriberium (Friar) on Nov 08, 2011 at 22:41 UTC

    What is the last message that's printed to LOG?

    That might help in finding the call that's causing the script to exit.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (4)
As of 2024-04-25 14:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found