From: Roland G. <RGi...@a1...> - 2001-11-27 15:04:05
|
> I'm trying to figure out how to handle a timeout. If I understand > correctly, I can determine if a call to expect() timed out by > examining the > second value in the return value list, e.g.: > > my(undef, $error) = $exp_obj->expect(10, "thisstring"); > > The documentation seems to say that when "thisstring" is not > found in 10 > seconds, $error will contain the string "1:TIMEOUT" . Do I have this > correct? Yes, this is correct. Also, the first return value will be undef. Another way would be to use callbacks, e.g.: $exp_obj->expect($timeout, [ qr"re_pattern" => sub { }], [ timeout => sub { die "Timeout" }], [ eof => sub { warn "EOF" }], ); See the Expect FAQ for an example. Hope this helps, Roland -- RGi...@cp... |