|
From: Blackstone, J. D. <jda...@ci...> - 2001-11-30 16:36:10
|
I learned this after much trial and error and thought I would share in case someone else wants to know. I figure someone will also point out a much easier way I should have considered first. In TCL expect, you can clear the current buffer with expect * (At least, I think you could. The code I'm translating immediately follows that statement with "expect -re .*". Both statements seem to be necessary for some reason, but the purpose is to clear the buffer.) To clear the buffer with Expect.pm, you can $expect->expect(0, '-re', qr/(.|\n)+/); The \n is necessary (and tripped me up quite painfully) because . doesn't match \n. (I used to know that, but those brain cells apparently burned up some while back.) $expect->expect(0) didn't seem to clear the buffer as I originally expected. jdb |