about summary refs log tree commit
diff options
context:
space:
mode:
authorGraham Barr <gbarr@pobox.com>2002-07-16 09:49:57 +0000
committerGraham Barr <gbarr@pobox.com>2002-07-16 09:49:57 +0000
commitece7ede5ff67fb9f5e830deadb34e3ee19c0f677 (patch)
tree5996c0106f9c98a198699ba754e5f759ebe7e7f0
parent35c22630c70514f10b5a5236b8cf9bc8620601d2 (diff)
downloadperl-libnet-ece7ede5ff67fb9f5e830deadb34e3ee19c0f677.tar.gz
Net::Cmd
- Ensure all debug output is via ->debug_print

-rw-r--r--Net/Cmd.pm25
1 files changed, 9 insertions, 16 deletions
diff --git a/Net/Cmd.pm b/Net/Cmd.pm
index 9093fcd..7d61bf9 100644
--- a/Net/Cmd.pm
+++ b/Net/Cmd.pm
@@ -1,4 +1,4 @@
-# Net::Cmd.pm $Id: //depot/libnet/Net/Cmd.pm#28 $
+# Net::Cmd.pm $Id: //depot/libnet/Net/Cmd.pm#29 $
 #
 # Copyright (c) 1995-1997 Graham Barr <gbarr@pobox.com>. All rights reserved.
 # This program is free software; you can redistribute it and/or
@@ -21,7 +21,7 @@ BEGIN {
   }
 }
 
-$VERSION = "2.21";
+$VERSION = "2.22";
 @ISA     = qw(Exporter);
 @EXPORT  = qw(CMD_INFO CMD_OK CMD_MORE CMD_REJECT CMD_ERROR CMD_PENDING);
 
@@ -73,7 +73,6 @@ sub _print_isa
  my @do   = ($pkg);
  my %spc = ( $pkg , "");
 
- print STDERR "\n";
  while ($pkg = shift @do)
   {
    next if defined $done{$pkg};
@@ -85,7 +84,7 @@ sub _print_isa
                 : "";
 
    my $spc = $spc{$pkg};
-   print STDERR "$cmd: ${spc}${pkg}${v}\n";
+   $cmd->debug_print(1,"${spc}${pkg}${v}\n");
 
    if(@{"${pkg}::ISA"})
     {
@@ -93,8 +92,6 @@ sub _print_isa
      unshift(@do, @{"${pkg}::ISA"});
     }
   }
-
- print STDERR "\n";
 }
 
 sub debug
@@ -398,10 +395,10 @@ sub datasend
  return 1
     unless length($line);
 
- if($cmd->debug)
-  {
-   my $b = "$cmd>>> ";
-   print STDERR $b,join("\n$b",split(/\n/,$line)),"\n";
+ if($cmd->debug) {
+   foreach my $b (split(/\n/,$line)) {
+     $cmd->debug_print(1, "$b\n");
+   }
   }
 
  # Translate LF => CRLF, but not if the LF is
@@ -457,17 +454,13 @@ sub dataend
  if(${*$cmd}{'net_cmd_lastch'} eq "\015")
   {
    syswrite($cmd,"\012",1);
-   print STDERR "\n"
-    if($cmd->debug);
   }
  elsif(${*$cmd}{'net_cmd_lastch'} ne "\012")
   {
    syswrite($cmd,"\015\012",2);
-   print STDERR "\n"
-    if($cmd->debug);
   }
 
- print STDERR "$cmd>>> .\n"
+ $cmd->debug_print(1, ".\n")
     if($cmd->debug);
 
  syswrite($cmd,".\015\012",3);
@@ -714,6 +707,6 @@ it under the same terms as Perl itself.
 
 =for html <hr>
 
-I<$Id: //depot/libnet/Net/Cmd.pm#28 $>
+I<$Id: //depot/libnet/Net/Cmd.pm#29 $>
 
 =cut