about summary refs log tree commit
diff options
context:
space:
mode:
authorGraham Barr <gbarr@pobox.com>1999-02-17 16:52:53 +0000
committerGraham Barr <gbarr@pobox.com>1999-02-17 16:52:53 +0000
commitb3371e793499ad26b8390fc5a0e53069c336bc84 (patch)
treed3b47f535ab72009be740bf3d548d53379f66d9d
parent92419eef0b75bd4aead070a5aa2e3176cac79e00 (diff)
downloadperl-libnet-b3371e793499ad26b8390fc5a0e53069c336bc84.tar.gz
Net::Cmd
- Added checks for a closed connection

-rw-r--r--Net/Cmd.pm8
1 files changed, 7 insertions, 1 deletions
diff --git a/Net/Cmd.pm b/Net/Cmd.pm
index 4ec3c5f..7c46b3c 100644
--- a/Net/Cmd.pm
+++ b/Net/Cmd.pm
@@ -13,7 +13,7 @@ use strict;
 use vars qw(@ISA @EXPORT $VERSION);
 use Carp;
 
-$VERSION = "2.12";
+$VERSION = "2.13";
 @ISA     = qw(Exporter);
 @EXPORT  = qw(CMD_INFO CMD_OK CMD_MORE CMD_REJECT CMD_ERROR CMD_PENDING);
 
@@ -159,6 +159,8 @@ sub command
 {
  my $cmd = shift;
 
+ return $cmd unless defined fileno($cmd);
+
  $cmd->dataend()
     if(exists ${*$cmd}{'net_cmd_lastch'});
 
@@ -337,6 +339,8 @@ sub datasend
  my $arr = @_ == 1 && ref($_[0]) ? $_[0] : \@_;
  my $line = join("" ,@$arr);
 
+ return 0 unless defined(fileno($cmd));
+
  return 1
     unless length($line);
 
@@ -389,6 +393,8 @@ sub dataend
 {
  my $cmd = shift;
 
+ return 0 unless defined(fileno($cmd));
+
  return 1
     unless(exists ${*$cmd}{'net_cmd_lastch'});