On Tue, 27 Sep 2005, Ing. Branislav Gerzo wrote: > Could be anyone so nice and write it ?
I'm sure someone *could*, but I wouldn't count on it happening :-) > I have some snippets here, using eval {} and catch errors with calling > recursive sub, but I don't think thats the best option. That's a reasonable line of thought. Here's a similar approach: my $tries = 0; while ( $tries < 10 ) { my $result = do_something_risky(); break if ( $result != 0 ); $tries++; if ( $tries == 10 ) { die "Couldn't do the risky thing after 10 tries, sorry. $!" } } sub do_something_risky { ... if ( $mischief_managed = 1 ) { return $mischief_managed; } else { return 0; } } The while() loop is the general strategy you need for the container code. How you manage the risky bit is up to you (eval{} is a good idea in many cases) but you need to take the resulting status (either a flag variable like the made-up $mischief_managed above or $? or what have you) and use that to control whether or not you keep looping. -- Chris Devers §GI¾¢,<ú
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>