From: Blackstone, J. D. <jda...@ci...> - 2001-12-13 15:59:39
|
I'm not exactly sure what parameters a timeout handler gets. I originally expected it to get the Expect object as its first parameter, like the other handlers in an expect(). A useful workaround is to use a closure for the handler: my $exp = Expect->spawn(...); $exp->expect(10, [qr/this.*/ => sub { $exp->send($response) } ], [timeout => sub { $exp->send($workaround) } ]); In this way, it's not necessary to access the parameter list in the handlers. Internally, I'm thinking _multi_expect() could use some reorganization to call all the handlers in the same way. Then, timeout handlers could use exp_continue, receive the Expect object as a parameter, etc. Hope I don't sound like I'm complaining; Expect.pm still rocks my world! jdb |