alienhuman has asked for the wisdom of the Perl Monks concerning the following question:
Hi Monks,
I'm using Net::FTP to great effect, however I've recently found some very strange behavior when I put a ftp method call into an if statement.
To wit:
The following method returns the value "1" when it is successful, as described in the perldoc, and evidenced in this snippet from the debugger...
DB<2> print $ftp->cwd( $whole ); Net::FTP=GLOB(0x47dbf4)>>> CWD /web Net::FTP=GLOB(0x47dbf4)<<< 250 CWD command successful. 1
However, the same method call inside an if statement doesn't evaluate TRUE... which is not at all what I expected...
DB<3> print if( $ftp->cwd( $whole ) ); Net::FTP=GLOB(0x47dbf4)>>> CWD /web Net::FTP=GLOB(0x47dbf4)<<< 250 CWD command successful. DB<4>
Why doesn't this if( $ftp->cwd( ... ) ); evaluate to true, if the value returned by $ftp->cwd is 1?
Thanks,
Chris
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Net::FTP & if statement behavior
by projekt21 (Friar) on Jan 02, 2002 at 22:53 UTC | |
by dmmiller2k (Chaplain) on Jan 02, 2002 at 23:00 UTC | |
by alienhuman (Pilgrim) on Jan 02, 2002 at 22:56 UTC | |
|
Re: Net::FTP & if statement behavior
by derby (Abbot) on Jan 02, 2002 at 23:03 UTC |