about summary refs log tree commit
diff options
context:
space:
mode:
-rw-r--r--lib/Net/Cmd.pm8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/Net/Cmd.pm b/lib/Net/Cmd.pm
index bdb2028..f9697cb 100644
--- a/lib/Net/Cmd.pm
+++ b/lib/Net/Cmd.pm
@@ -6,6 +6,10 @@
 # the same terms as Perl itself, i.e. under the terms of either the GNU General
 # Public License or the Artistic License, as specified in the F<LICENCE> file.
 
+# NOTE:  We need to use $cmd->syswrite(...) and $cmd->sysread(...)
+# instead of syswrite($cmd, ...) and sysread($cmd, ...) throughout
+# this package to support COMPRESS in Net::NNTP alongside
+# IO::Socket::SSL without breaking backwards compatibility.
 package Net::Cmd;
 
 use 5.008001;
@@ -207,7 +211,7 @@ sub _syswrite_with_timeout {
     my $nfound = select(undef, $wout = $win, undef, $pending);
     if ((defined $nfound and $nfound > 0) or -f $cmd)    # -f for testing on win32
     {
-      my $w = syswrite($cmd, $line, $len, $offset);
+      my $w = $cmd->syswrite($line, $len, $offset);
       if (! defined($w) ) {
         my $err = $!;
         $cmd->close;
@@ -350,7 +354,7 @@ sub getline {
   my $err;
 
   until ($err || scalar(@{${*$cmd}{'net_cmd_lines'}})) {
-    my $r = sysread($cmd, $partial, 1024, length($partial));
+    my $r = $cmd->sysread($partial, 1024, length($partial));
     if (defined($r)) {
       if ($r > 0) {
         my @buf = split(/\015?\012/, $partial, -1);    ## break into lines