From: Matt Z. <mzagrabe@d.umn.edu> - 2010-09-16 14:36:33
|
On Thu, Sep 16, 2010 at 12:47 AM, Rajan Vijayaraghavan <raj...@gm...> wrote: > I tried $expect_obj->before() but it does not return the entire output. > > On Wed, Sep 15, 2010 at 11:07 PM, Satish Pothuri <sat...@gm...> > wrote: >> >> >> you can use expect before() function to get the command output. It >> actually captures the date from last expect string to current expect string. >> variable = $exp_obj->before() >> >> On Wed, Sep 15, 2010 at 11:31 PM, Rajan Vijayaraghavan >> <raj...@gm...> wrote: >>> >>> All, >>> I am using Perl with Expect for automating wpa_cli for wps. >>> I have a general question. For example if a command has been sent to >>> to either a remote machine or a spawned process, how to read the >>> entire output of the command executed. How does expect store so >>> that I can parse and use it for later purpose? Note, this is from memory: >From Expect.pm: $object->log_file("filename" | $filehandle | \&coderef | undef) my $expect_io; $object->log_file(sub { $expect_io .= $_; }); #Do stuff with Expect #Do stuff with $expect_io; HTH -matt |