problem with Perl script piping data from gpg

Tuomas Pellonpera tp58494@uta.fi
Wed Oct 10 17:39:02 2001


Hi!

I am writing a Perl (CGI) script that would encrypt data using gpg. In an
attempt to avoid the problems with bidirectional pipes, my script
creates a temporary file (the name of which will be known). Then I would
like gpg to encrypt this file and print the "result" to stdout, where I
would save this to a scalar variable. (This may be a clumsy way of
accomplishing this task, but what would you expect from a beginning Perl
programmer? :)

Let 'tempo' be the temporary file created. 'tuope' is my user ID. So I
have these lines of code:

open(KRYPT, "gpg -ea -r tuope tempo |") or
    die "Could not run program: $!\n";
while(<KRYPT>) {
    $crypt .=3D $_;
}
close(KRYPT);

My problem is that, instead of writing to stdout, gpg creates a file
'tempo.asc'. (I tested the code at home, but it never gave the result I
wanted. :() What could be done to "remedy" this code? :)

Thanks.
Tuomas

--=20
Tuomas Pellonper=E4
<tp58494 AT uta.fi> && http://www.iki.fi/tuomas.pellonpera/

GPG (http://www.gnupg.org/) public key:
http://www.iki.fi/tuomas.pellonpera/gnupgkey.txt