Re: BUG: variables.pl

New Message Reply Date view Thread view Subject view Author view Attachment view

From: Steve Hideg (hideg@saintmarys.edu)
Date: Wed Aug 23 2000 - 12:50:21 CDT


You should really be using "eq" instead of "==" for string
comparisons. Coercion does take place (which is why "==" works), but
I would recommend using the proper comparison operator.

++Steve

At 12:12 PM -0500 8/23/00, Peter Valian wrote:
>All,
>
>I have found a bug that's been bugging us (guess thats why they call 'em
>bugs).
>In version 1.2, variables.pl:
>
> $AUTH_METHOD = "POP"; # possible values: (FTP|POP)
> if ($AUTH_METHOD = "POP") { use Mail::POP3Client; }
> if ($AUTH_METHOD = "FTP") { use Net::FTP; }
>
>the problem is in the if statements...it's not using the comparison
>operator, it's using the assignment operator.
>
>The reason this is a legal statement is because the evaluation of an
>assignment is true.
>
>It should be:
>
> $AUTH_METHOD = "POP"; # possible values: (FTP|POP)
> if ($AUTH_METHOD == "POP") { use Mail::POP3Client; }
> elsif ($AUTH_METHOD == "FTP") { use Net::FTP; }
>
>NOTE: the second 'if' should really be an 'elsif' since there is no
>reason to evaluate it if the first 'if' statement is true.
>
>This will be fixed in the next version...we were wondering why NetReg
>was using FTP to authenticate instead of POP. It was because the second
>'if' was setting
>$AUTH_METHOD equal to FTP.
>
>Sorry.
>
>-peter
>
>--
>Peter Valian
>Network & Systems Administator
>Southwestern University
>Georgetown, Texas
>512.863.1586
>--
>**********************************************************************
>To unsubscribe from this list, send an e-mail message to
>majordomo@southwestern.edu containing a single line with the words:
>unsubscribe netreg
>Send requests for assistance to: owner-netreg@southwestern.edu
>**********************************************************************

**********************************************************************
To unsubscribe from this list, send an e-mail message to
majordomo@southwestern.edu containing a single line with the words:
unsubscribe netreg
Send requests for assistance to: owner-netreg@southwestern.edu
**********************************************************************


New Message Reply Date view Thread view Subject view Author view Attachment view

This archive was generated by hypermail 2.1.4 : Thu Aug 12 2004 - 12:01:34 CDT