inoci has asked for the wisdom of the Perl Monks concerning the following question:
i'm paraphrasing, but that's the gist of it. this way i can see the results of COMMAND as @command_results. i then chop that up and have some other things happen that then prompt one of several other commands. normal expect matches don't work for me, mostly because much of this needs to be returned to the user at the end of the script. i also don't want to have to read/write a file for each time this is done for a variety of reasons, not least of which is the permissions on the folder this will be run from (nothing i can control).#jumping into the relevent bits... $command->log_file(undef); if ($command->expect(2,"/>")){ $command->log_file("$TEMPFILE") or die; print $command "<i>COMMAND</i>\r"; } if ($command->expect(5,"/>")){ $command->log_file(undef); } open (LOG, "$TEMPFILE") or die; @command_results=<LOG>; close LOG;
so, i have 2 questions:
1. can i have a filehandle to point the expect log at that isn't actually a file?
2. is there a better way to grab the output of a command with Expect.pm than using the log file?
edited: Tue Apr 8 22:30:17 2003 by jeffa - code tags
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: 'virtual' filehandles...
by graff (Chancellor) on Apr 08, 2003 at 23:34 UTC | |
by nothingmuch (Priest) on Apr 09, 2003 at 00:55 UTC |