For anyone who is interested, I found a solution and will post it for anyone else having problems working with open3. I got the following code to work on linux, but am still trying to figure out how to get it to work on my win2k box.
#!/usr/bin/perl -w # pgp_test.pl <user_id> <passphrase> use strict; use IPC::Open3; my $encrypt_opts = '+force +batchmode +verbose=1 -fea'; my $decrypt_opts = '+force +batchmode +verbose=1 -f'; my $key = shift || 'zzSPECTREz'; my $passphrase = shift || '###MYSECRET KEY##'; sub encrypt () { my ($user_key, $text) = @_; my $pid = open3(\*PGPIN,\*PGPOUT,\*PGPERR,"pgp $encrypt_opts $user_k +ey"); print PGPIN $text; close (PGPIN); my $output = join ('',<PGPOUT>); return $output; } sub decrypt () { my ($text) = @_; my $pid = open3(\*PGPIN,\*PGPOUT,\*PGPERR,"pgp $decrypt_opts -z '$pa +ssphrase'"); print PGPIN $text; close(PGPIN); my $output = join ('',<PGPOUT>); return $output; } print "\nTEST PGP\n\n"; print "ENTER TEXT TO ENCRYPT: "; my $data = <STDIN>; my $enc_data = &encrypt ($key,$data); print "\nDATA ENCRYPTED:\n$enc_data\n\n"; my $dec_data = &decrypt ($enc_data); print "DATA DECRYPTED:\n$dec_data\n\n";
zzSPECTREz
In reply to Re: IPC::Open2 Help.
by zzspectrez
in thread IPC::Open2 Help.
by zzspectrez
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |