From: Ivan t. P. <ru...@ve...> - 2009-03-10 13:59:03
|
I'm using Expect to configure an ill-behaved network device and having problems. The device has the characteristic that is sends out 'lines' consisting of '\n', or '\r\n' and nothing else. This causes problems as '^$' will not match the later and will match 'nothing' which does not consume any of the input that's been accumulated. I used clear_accum when before() or after() matched the patterns in question, but that does not seem to cause the accumulator to acquire more content (and the expect times out). I also tried something crude like set_accum(' ') when either of the undesirable patterns matched, just so something ended up in the accumulator. (I was hoping to 'prime the pump' and force another read for more input from the device.) The device timed out. I even tried matching '^.*?\r(.*)$' and '^(?:.*?\r)?(.*)$' combined with set_accum($1), but all that does is turn '\r\n' into '\n' which then fails as I can't use '^$' to match. Has anyone run into this 'empty line' problem before? How did you work around it? -- View this message in context: http://www.nabble.com/Help-with-Ill-behaved-Device-Output-tp22434758p22434758.html Sent from the Perl - Expectperl-Discuss mailing list archive at Nabble.com. |