in reply to WWW::Mechanize and connection errors
Second, I would probably avoid the evil goto - something like:sub my_get { my ($self) = shift(@_); my $result; eval { $result = $self->get(@_); }; # ... if $@ return $result; }
Third, I would consider that you have introduced an infinite loop and would probably re-write it to include a $CONFIG{MAX_RETRY}. The code above is not intended to be copy/paste but give you an idea of how it might be accomplished - you will need to fill in the blanks.my $success; while (! $success) { eval { $mech->get(@_); }; if (! $@) { $success = 1; } else { sleep $CONFIG{DELAY}; } }
If your real problem is that you have never sub-classed before at all then you should probably make that clear. After reading your question again, I am not sure if you just don't know how to subclass in general or how to write the wrapper to do what you want.
Cheers - L~R
|
|---|