On Tue, 2009-07-14 at 10:58 -0400, Chas. Owens wrote: > You just removed a major feature of the code. Do you want to explain > why your paranoia has lead you to remove the ability to override the > default $timedout and $error handlers? I could understand if your > paranoia lead you to check to make sure the types were right: >
What happens here? timeout 1, sub { die "oops\n" }, sub { warn "died with $@" }; Try: sub timeout { my $wait = shift @_; my $code = shift @_; my ( $timedout, $error ); if( ref( $_[0] ) && ref( $_[0] ) eq 'CODE' ){ $timeout = shift @_; }else{ $timeout = sub { warn $@ }; } if( ref( $_[0] ) && ref( $_[0] ) eq 'CODE' ){ $error = shift @_; }else{ $error = sub { die $@ }; } -- Just my 0.00000002 million dollars worth, Shawn Programming is as much about organization and communication as it is about coding. Regardless of how small the crowd is, there is always one in it who has to find out the hard way that the law of gravity applies to them too. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/