it appears pgp verifies you are using a terminal to prevent anything it considers fishy. I would sugest taking a look at the Crypt::OpenPGP module, as i believe it will do what you want.
woo hoo, 200th posti had a memory leak once, and it ruined my favorite shirt.