From: <ex...@ih...> - 2002-05-24 15:57:57
|
On Fri, 24 May 2002 09:48:33 +0200 RGi...@a1... wrote: > > I'm running expect to talk to a script and I have the questions > > (that the script asks) and the answers. I am running it inside a > > foreach loop based on number of questions/answers. > > > > Like so: > > > > $exp = Expect->spawn('script'); > > > > foreach $qa (0..$#qaarray) > > { > > $exp->expect($timeout, $qaarray[$qa]) > > $exp->send($aarray[$qa]); > > } > > > > > > The time between when an answer is given and when a new > > question is asked varies. In some cases it may take an > > hour and in others less than 1 second. The problem I have > > is that expect timesout and does a hard_close after some > > amount of time. > > Yes, after the amount of time you specify in $timeout... > > > I need it to wait for the next question > > no matter how long it takes. I've read the docs and tried > > a lot of different things. > > Really? So you obviously didn't notice this in the docs: > > "Given $timeout in seconds Expect will wait for $object's > handle to produce one of the match_patterns. Due to o/s > limitations $timeout should be a round number. If > $timeout is 0 Expect will check one time to see if > $object's handle contains any of the match_patterns. If > $timeout is undef Expect will wait forever for a pattern > to match." Yes, saw this. Maybe I haven't framed the question properly. But that might just be that I don't understand the problem properly. With debugging on and $timeout not defined I get this "Timed out waiting for an EOF from spawn id(6)" and then it does a hard close. I'm really pining for more examples of using this module, I saw kibitz but there isn't much else. I can read the docs until I'm blue but I tend to benefit more from seeing things in action. Thanks for any help. |