gpg to sign cgi output?

Paul Dalton Paul Dalton" <
Mon, 10 Apr 2000 17:26:19 +0100

    I want to use gpg to sign the data input to a form on a  web site, and
then email it. The bit I'm having the prolems with is the signing. I can't
get gpg to a) use a default private key and b) sign the file. I'm putting
the data input into a  text file, trying to get gpg to sign it ascii
armored, but it complains that it can't send the passphrase (im
using --batch). heres the command string I'm using:
$command="gpg --no-secmem-warning --default-key
USERID --clearsign --batch --h
omedir /root/.gnupg --armor --output /PATH/$output  /PATH/$filename";

my cgi script is written in perl btw, the server is redhat linux 6.1
(running apache), and its an internal web site I'm using this on, no one has
access to this machine other than through http (port 80) (from the internal
network, no access from outside) so I think its relatively safe.

Can what I am trying to do be done? Have I got my args mixed up?

Any help much appreciated.