Gerard's Perl Page
Index
Home
About
Old News
Contribute



Portfolio
metamail
rifle
ubh
whatpix
ydecode

Links
use Perl;
Perl Monks
www.perl.com
ActiveState
CPAN
Perl User Groups
Perl Mongers
Powered By Perl
Template Toolkit
Emacs

Bug In Net::Cmd
by gerard on Fri Jan 26 00:00:00 PST 2001

Adam Rice writes:

    I believe the cause of the problem to be the following line in the command() method of Net::Cmd:
      return $cmd unless defined fileno($cmd);
    which causes the method to fail silently if the connection has gone away. What I consider to be the bug is that the return code from the previous command is retained, so [applications] cannot correctly detect the error.
The workaround is to explicitly call fileno() explicitly on your Net::Cmd-derived object (such as Net::NNTP) in order to detect and handle such errors.
    
          if ($obj->code() eq "000" || !defined fileno($obj)) {
    
              # Handle error here...