in reply to Using perl module Expect.pm

I think you can use before() to accomplish this. From the docs:
   $object->before()
       before() returns the 'before' part of the last
       expect() call. If the last expect() call didn't match
       anything, exp_before() will return the entire output
       of the object accumulated before the expect() call
       finished.
And further down in Q&A:
   Ok, so now how do I get what was read on the handle?

     $read = $process->before();

jeffa

L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
B--B--B--B--B--B--B--B--
H---H---H---H---H---H---
(the triplet paradiddle with high-hat)
  • Comment on (jeffa) Re: Using perl module Expect.pm

Replies are listed 'Best First'.
Re: (jeffa) Re: Using perl module Expect.pm
by gnangia (Scribe) on Dec 11, 2002 at 17:04 UTC
    Hi jeffa,
    I have already looked at that and it is returning the received string + what I sent rather than just the string that it receives. So I then need to modify the contents of $object->before(). I was hoping to just to get what was received rather than sent+received. I also inserted a $object->clear_accum() thinking that it would clear the buffer of what was sent. However, it did not make a difference.