From: Roland G. <RGi...@cp...> - 2002-07-23 09:06:05
|
> Ok, I know it's not healthy to talk to myself.... ;^) Well, it's a start... :-) > The problem seems to be some difference in how regex is handled. > > If I just do $obj->expect(undef, $item); > everything works fine. > > If I use instead $obj->expect(undef, -re => "$item"); > Things fail mysteriously (to me anyway). I'm certain that my > understanding > of this module is incomplete so it's possible that I'm missing the > distinction between these 2 idioms. perldoc Expect: Changed from older versions is the regular expression handling. By default now all strings passed to expect() are treated as literals. To match a regular expression pass '-re' as a parameter in front of the pattern you want to match as a regexp. Example: $object->expect(15, 'match me exactly','-re','match\s+me\s+exactly'); Anything unclear with that? Should the docs be worded differently? > > > The spawned program is an sh script. The timeout comes only after > > > a few seconds at one point when the script is doing work. > > > Why is it timing out? Is something strange happening to > > > $end_time? > > > > > > Here's the bit of code from Expect.pm that gets me > > > to this point: > > > > > > 1329: if (($end_time <= time()) && ${*$self}{exp_Debug}) { > > > 1330: print STDERR "Timed out waiting for an EOF from > ${*$self}{exp_Pty_Handle}.\r\n"; > > > 1331: } > > > > > > Can anyone provide any clues? Without you providing more code? No. Hope this helps, Roland -- RGi...@cp... |