On 02-04-08 03:09:41 CEST, Marcel Juffermans wrote:
> In OpenSSL.pm there is a code snippet:
> 
> if( not(defined($outfile)) || $outfile eq "" ) {
>   <snip/>
> } else {
>   <snip/>
> }
> 
> This doesn't seem to work as expected - if $outfile is undefined, then the
> else clause is taken.
> 
> It works as expected if the condition is changed to use 'or' instead of
> '||':
> 
> if( not(defined($outfile)) or $outfile eq "" )

if (!defined($outfile) || $outfile eq "") {

would work too

> or even just:
> 
> if( !$outfile )

100% correct, both the undefined value and the empty string (and a zero
and a string "0") evaluate to a boolean false, so the expression is
overly redundant anyway.

and the undefined value evaluates to the empty string in string
comparison, so

if ($outfile eq "") {

has the same behaviour.

rj

_______________________________________________
OpenCA-Devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/openca-devel

Reply via email to