David Gerler <[EMAIL PROTECTED]> wrote:
> I have successfully piped a print statement to gpg. My problem
> is coming in when I try to get it back out via a pipe. Can anyone
> tell me, is it possible to send data to a another program and the
> output back with out writing it to a file?

Try the standard IPC::Open2 module.

  $ perldoc IPC::Open2

I found that. Here's what I wrote:
#!/usr/bin/perl -w

use IPC::Open2;


if ($^O =~ /MSWin/i) {
   $tempdir = 'c:/temp/';
   $OS = "windows";
} else {
   $OS = "unix";
   $mail_prog = '/usr/lib/sendmail';

}

if ($OS eq "windows") {
$outfile = ".\\$scratchPad\\"."temp1.txt";
$cmd = "c:\\gnupg\\gpg -ea -r ezbid > $outfile";
} else {
#$outfile = "./temp1.txt";
$outfile = $dir . "temp1.txt";
$cmd = "gpg -ea -r ezbid --always-trust --no-secmem-warning >
$outfile";
}
$number;

$pid = open2(\*FILEIN, \*GPGOUT, "| $cmd");
print GPGOUT $number;

while (<FILEIN>) {
          $temp .= $_;
          }
close FILEIN;

After executing I get "I was unexpected at this time" from perl
builder. The perldoc was not very clear on usage. No example code. Can
you direct me to an example?
I appreciate your help.
Dave




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to