From: <RGi...@a1...> - 2002-05-24 07:48:46
|
> 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." Hope this helps, Roland -- RGi...@cp... |
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. |
From: Roland G. <RGi...@CP...> - 2002-05-25 20:40:39
|
> 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. Oh, but this error message comes from soft_close(), so there already was something unusual happening... > 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. Sorry, there aren't really any, except those two in the FAQ. Maybe somebody would care to post some example code from their applications? Unfortunately I left my code at my previous employer... Roland -- RGi...@cp... |
From: <ex...@ih...> - 2002-05-25 22:01:43
|
On Sat, 25 May 2002 22:40:29 +0200 Roland Giersig <RGi...@CP...> wrote: > > 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. > > Oh, but this error message comes from soft_close(), so there already > was something unusual happening... Yes I guess I'll keep digging around. > > > 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. > > Sorry, there aren't really any, except those two in the FAQ. > Maybe somebody > would care to post some example code from their applications? > Unfortunately I've got one example another reader sent along for doing cisco stuff. That helps. On another topic I think that the case when $timeout is undef isn't working properly. i.e. I think it's getting defined anyway but it's defined to the expect expression. I think something is getting shifted off but shouldn't be. I was seeing under debug that it was trying to subtract (line 612) using the expect string. Thanks. |
From: Stephen Q. <st...@ja...> - 2002-05-26 21:25:49
|
On Sat, May 25, 2002 at 03:01:26PM -0700, ex...@ih... wrote: > On another topic I think that the case when $timeout is undef > isn't working properly. i.e. I think it's getting defined > anyway but it's defined to the expect expression. I think something is > getting shifted off but shouldn't be. I was seeing under debug > that it was trying to subtract (line 612) using the expect string. I wonder if what you are doing here is $t->expect(,'-re',$pattern); or $t->expect('-re',$pattern); instead of $t->expect(undef,'-re',$pattern); if you want an undefined time out, i.e. it waits forever to match the pattern, you need to state that specifically. Stephen |
From: R. H. <rhu...@ih...> - 2002-05-27 05:02:05
|
On Sun, 26 May 2002 22:25:40 +0100 Stephen Quinney <st...@ja...> wrote: > On Sat, May 25, 2002 at 03:01:26PM -0700, ex...@ih... wrote: > > > On another topic I think that the case when $timeout is undef > > isn't working properly. i.e. I think it's getting defined > > anyway but it's defined to the expect expression. I think something is > > getting shifted off but shouldn't be. I was seeing under debug > > that it was trying to subtract (line 612) using the expect string. > > I wonder if what you are doing here is > > $t->expect(,'-re',$pattern); > > or > > $t->expect('-re',$pattern); > > instead of > > $t->expect(undef,'-re',$pattern); Sorry I missed this important distinction. It says it right there in the man page too.... Thanks. > > if you want an undefined time out, i.e. it waits forever to match the > pattern, you need to state that specifically. > > Stephen > > _______________________________________________________________ > > Don't miss the 2002 Sprint PCS Application Developer's Conference > August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm > > _______________________________________________ > Expectperl-discuss mailing list > Exp...@li... > https://lists.sourceforge.net/lists/listinfo/expectperl-discuss > |