about summary refs log tree commit
diff options
context:
space:
mode:
authorGraham Barr <gbarr@pobox.com>2000-01-17 14:24:11 +0000
committerGraham Barr <gbarr@pobox.com>2000-01-17 14:24:11 +0000
commit3dd5b5facc0757628b5c8f7131eed5e9029dd56f (patch)
tree7059857d6d5757a4e881ca400d5018b1f21ccb04
parent4a2765c0b294a598f2f0d3c84682a58c3e79d3fe (diff)
downloadperl-libnet-3dd5b5facc0757628b5c8f7131eed5e9029dd56f.tar.gz
Net::Cmd
- fix getline not to drop blank lines

-rw-r--r--Net/Cmd.pm8
1 files changed, 3 insertions, 5 deletions
diff --git a/Net/Cmd.pm b/Net/Cmd.pm
index 1dae8e8..e6870e7 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.16";
+$VERSION = "2.17";
 @ISA     = qw(Exporter);
 @EXPORT  = qw(CMD_INFO CMD_OK CMD_MORE CMD_REJECT CMD_ERROR CMD_PENDING);
 
@@ -239,15 +239,13 @@ sub getline
 
      substr($buf,0,0) = $partial;        ## prepend from last sysread
 
-     my @buf = split(/\015?\012/, $buf);        ## break into lines
+     my @buf = split(/\015?\012/, $buf, -1);        ## break into lines
 
      $partial = length($buf) == 0 || substr($buf, -1, 1) eq "\012"
                 ? ''
                   : pop(@buf);
 
-     map { $_ .= "\n" } @buf;
-
-     push(@{${*$cmd}{'net_cmd_lines'}},@buf);
+     push(@{${*$cmd}{'net_cmd_lines'}}, map { "$_\n" } @buf);
 
     }
    else