problem with Perl script piping data from gpg
Anthony E. Greene
agreene@pobox.com
Wed Oct 10 21:01:02 2001
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Wed, 10 Oct 2001, Tuomas Pellonpera wrote:
>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 .= $_;
>}
>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? :)
By default, gpg processes files or pipes. If you want the output on
STDOUT, you have to provide the input on STDIN:
open(KRYPT, "gpg -ea -r tuope < tempo |")
Tony
- --
Anthony E. Greene <agreene@pobox.com> <http://www.pobox.com/~agreene/>
PGP Key: 0x6C94239D/7B3D BD7D 7D91 1B44 BA26 C484 A42A 60DD 6C94 239D
Chat: AOL/Yahoo: TonyG05
Linux. The choice of a GNU Generation. <http://www.linux.org/>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: Anthony E. Greene <agreene@pobox.com> 0x6C94329D
iD8DBQE7xJqQpCpg3WyUI50RAu8vAJ41SuMwYt4ZAQ0QjK5e/IrwC+6OZgCdF3J3
vqtuVinZ77OEon1Ul5agAI0=
=qNnU
-----END PGP SIGNATURE-----