Crypt::GPG won't decrypt file



Hi folks,

I have the following function:

sub lbx_decrypt {

my $encrypted = shift or die "No file passed in to lbx_decrypt for
decryption?\n";
my $decrypted = substr $encrypted, 4;
$decrypted .= '.zip';

my $gpg = new Crypt::GPG;
$gpg -> gpgbin('/usr/bin/gpg');

open CIPHERTXT, $encrypted or die "Can't open file: $encrypted:
$!\n";
my @ciphertxt = <CIPHERTXT>;

# The decrypted file is a zip file which we will unpack later
my($cleartxt, $signature) = $gpg -> decrypt(\@ciphertxt); # or die
"Can't decrypt $encrypted: $!\n";

open CLEARTXT, ">", $decrypted or die "Can't open decrypted file for
writing: $decrypted\n";
print CLEARTXT $cleartxt or die "Can't write decrypted file: $!\n";
close CLEARTXT;

return $decrypted;
}

There's not much to it. It seems like it should work, but when I run it,
I get this error:

Use of uninitialized value in print at ./rewrite.pl line 240,
<CIPHERTXT> line 38.

Strangely, this same function works in another program, minus the "zip"
stuff at the top.

I'm at a loss as to how to figure this out. Any help would be greatly
appreciated.
Thanks!

richf
.