Baz has asked for the wisdom of the Perl Monks concerning the following question:
Over time I've improved the performance of this script. For example, when I get a webpage, I check it to ensure that the page is presenting the data in the correct format. This is necessary because from time to time the server reports that it is busy and the webpage will therefore contain the message "busy, call back later" rather than the expected data. To handle this, I poll this page a number of times, and if I keep getting this busy message, I jump to Start, and start processing this name again from scratch. The busy message is not related to the fact that the server is busy, because when I start the name again I no longer get this message.#!/usr/bin/perl -w use strict; $| = 1; use CGI::Carp "fatalsToBrowser"; use CGI ":all"; use warnings FATAL => 'all'; my @names = ( "name1", "name2", "name3", ); Start: foreach my $name (@names) { if(!name already_in_database()) { $res = $ua->get( $url1); if(expected_data_not_found_on_a_continous_bases()) { goto Start; } ... add_data_found_to_database_for_this_name(); } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Script dieing after arbitrary time
by scmason (Monk) on May 18, 2005 at 20:17 UTC | |
|
Re: Script dieing after arbitrary time
by bart (Canon) on May 18, 2005 at 21:38 UTC | |
by Baz (Friar) on May 18, 2005 at 22:44 UTC | |
|
Re: Script dieing after arbitrary time
by TheStudent (Scribe) on May 18, 2005 at 20:46 UTC |