Problem with Perl Call

Jenkins, Graham K [IBM GSA] Graham.K.Jenkins@team.telstra.com
Fri Mar 8 02:50:01 2002


Guys, I have been trying to feed a passphrase into
gpg 1.0.6 (on NetBSD, Solaris and Win32) platforms)
using a variation of a script suggested in some of the
pgp documentation.  Here's what I tried.  If somebody
can tell me why it doesn't work, I'd be Real Pleased ..
--
#!/usr/local/bin/perl
pipe(READER,WRITER);
if (!fork) {
	close(WRITER);
	$^F=fileno(READER);
	$FilDes=fileno(READER);
	exec "gpg -as --passphrase-fd $FilDes </etc/passwd >/tmp/outZ" or
	die "can't exec gpg\n";
}
close(READER);
syswrite(WRITER, "secret1\n", 8);
close(WRITER);
wait
--