I had a look.... The documentation is *very* lacking.....
savage@netsonic:~/src# perl -MIPC::Open2 -e'open2($rd, $wr, "ls -al"); while (<$rd>) { print; } exit;' open2: wtr should not be null at -e line 1 Needless to say, I am *totally* clueless.... :((( ----- Original Message ----- From: "Tanton Gibbs" <[EMAIL PROTECTED]> To: "Chris Knipe" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Wednesday, July 17, 2002 9:25 PM Subject: Re: executing binaries > The Perl Cookbook recipie 16.8 says > use the standard IPC::Open2 module: > > use IPC::Open2; > > open2(*README, *WRITEME, $program); > print WRITEME "Here's your input\n"; > $output = <README>; > close(WRITEME); > close(README); > > However, it warns that there could be problems if the other program buffers > input or output. You should probably perldoc IPC::Open2 for all of the > details. > ----- Original Message ----- > From: "Chris Knipe" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Wednesday, July 17, 2002 3:09 PM > Subject: executing binaries > > > > Lo all, > > > > What's the best way to execute a binary command from within perl, and read > > text returned by the binary, as well as write data to certain prompts that > > the program may have? > > > > Say, I have... > > > > #>./myprogram > > This is my program, I will ask you a question now > > Please give me your name: WHATEVER > > Thank you. > > > > In this instance, I want to read the output from the program, wait for > > "name:", and send it WHATEVER. Then, based on the exit code of the > > application, I want to execute various code (say, when the program exits > > successfully, of when there is a error).... > > > > Does anyone have some pointers on this for me? How can I accomplish > this.. > > To my understanding, both system() and exec() are out of bounds here... Or > > am I wrong? > > > > -- > > me > > > > > > > > -- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]