zentara has asked for the
wisdom of the Perl Monks concerning the following question:

Hi,
Someone asked on the perl.beginners maillist, a question about running gpg thru a script. Well I thought It could be run thru IPC::Open3, but there is a complication. Gpg grabs the tty
of the perlscript, preventing IPC from operating.

If you run the script below(modified to edit a suitable name for your system), gpg, grabs the tty. If you enter "trust" followed by Enter, a new menu appears. That is the functionality I'm trying to perform thru the script.

If I print to the IN filehandle, it does nothing. I've noticed that the Crypt::GPG module uses IPC::Run and an undocumented gpg option called "--no-tty", but that aside, I just want to know how to access the STDIN to
gpg.

On my system gpg is shown using /dev/pts/5, and I can't seem to be able to print to it. Is it possible thru some sort of fileno magic?

I explored CPAN's GPG/PGP modules a while back. Most of them either don't compile or fail their tests on Fedora Core 3. The GPG interfaces on CPAN seem to have been left to rot, which means doing your own IPC to the executable is probably the safest choice at the moment. (Or put in the effort to clean one of them up, if you have the time and interest.)

Most of them either don't compile or fail their tests on Fedora Core 3.

Seeing how most everything fails on fedora core :)(that locale issue) and there is a few passes, I wouldn't discount them without good examination (i have successfully used at least 2 of those).

update: also, a lot of those FAILS are a case of Can't exec "gpg": No such file or directory , which means the test suite isn't the best (assumes you have gpg installed),
but doesn't indicate an actual failure.

MJDsays "you can't just make shit up and expect the computer to know what you mean, retardo!"

Just in case anyone is interested I found an answer. After muddling thru all the modules, and seeing how it was done, I decided to get the latest version of gpg ( 1.4.1) and look thru the docs for a new option called --command-fd which is a file descriptor which gpg will use to accept commands in a --no-tty mode. It works. :-)