ps...you're checking if it has a value, 256 (a typical error return
code) would pass that test.



On 5/25/06, Anthony Ettinger <[EMAIL PROTECTED]> wrote:
check $? or $!

$gp->foo() or die "$!";

my $output = $gp->foo();
print "return code: $?";

see perldoc perlvar





On 5/25/06, Jason Balicki <[EMAIL PROTECTED]> wrote:
> I'm back.
>
> This is a piece of code taken from a larger program.
>
> I'm trying to determine that the encryption succeded, but when
> I try to evaluate the code, it always evaluates false even though
> the encryption works and produces an encrypted file.
>
> Here's the specific bit I'm concerned with:
>
> if ($gpg->encrypt ( plaintext => $infile, output => $outfile, recipient => 
$recipient )){
>         $encrypt_status = "success";
> }
>
> This always evaluates as false and never sets $encrypt_status to "success" 
even
> though the encryption does, in fact, succeed.
>
> And here it is in context:
>
> #!/usr/bin/perl
> use GnuPG;
> use strict;
> use warnings;
>
> my $recipient = "[EMAIL PROTECTED]";
>
> my $infile = $ARGV[0];
> my $outfile = $ARGV[1];
> my $encrypt_status = "failed";
>
> if ( -z $infile) {
>         open (PLAIN, "<<$infile") or die "Can't open $infile for reading!";
> }
> open (ENCRYPT, ">>$outfile") or die "Can't open $outfile for writing!";
>
> my $gpg = new GnuPG( );
>
> if ($gpg->encrypt ( plaintext => $infile, output => $outfile, recipient => 
$recipient )){
>         $encrypt_status = "success";
> }
>
> close ( PLAIN );
> close ( ENCRYPT );
>
> print "encrypt status: $encrypt_status\n";
>
> What am I doing wrong?
>
> Thanks,
>
> --J(K)
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> <http://learn.perl.org/> <http://learn.perl.org/first-response>
>
>
>


--
Anthony Ettinger
Signature: http://chovy.dyndns.org/hcard.html



--
Anthony Ettinger
Signature: http://chovy.dyndns.org/hcard.html

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to