[BACK]Return to Trango.pm CVS log [TXT][DIR] Up to [local] / trango / Net-Telnet-Trango / lib / Net / Telnet

Diff for /trango/Net-Telnet-Trango/lib/Net/Telnet/Trango.pm between version 1.14 and 1.18

version 1.14, 2006/09/07 03:49:34 version 1.18, 2006/09/12 03:13:08
Line 1 
Line 1 
 package Net::Telnet::Trango;  package Net::Telnet::Trango;
 # $RedRiver: Trango.pm,v 1.13 2006/09/07 02:39:36 andrew Exp $  # $RedRiver: Trango.pm,v 1.17 2006/09/12 01:17:46 andrew Exp $
 use strict;  use strict;
 use warnings;  use warnings;
 use base 'Net::Telnet';  use base 'Net::Telnet';
Line 246 
Line 246 
   
 reboots the trango and closes the connection  reboots the trango and closes the connection
   
   =item remarks
   
   Takes an optional argument, which sets the remarks.
   If there is no argument, returns the current remarks.
   
 =item sulog  =item sulog
   
 returns an array ref of hashes containing each log line.  returns an array ref of hashes containing each log line.
Line 274 
Line 279 
   
 returns the output from the eth list command  returns the output from the eth list command
   
   =item su_info
   
   You need to pass in args => <suid> and it will return the info for that suid.
   
   =item save_ss
   
   saves the config.  Returns 1 on success, undef on failure.
   
 =cut  =cut
   
   
Line 286 
Line 299 
   sulog       => { decode => 'sulog', expect => $success },    sulog       => { decode => 'sulog', expect => $success },
   'exit'      => { no_prompt => 1, cmd_disconnects => 1 },    'exit'      => { no_prompt => 1, cmd_disconnects => 1 },
   reboot      => { no_prompt => 1, cmd_disconnects => 1 },    reboot      => { no_prompt => 1, cmd_disconnects => 1 },
     remarks     => { decode => 'all', expect => $success },
   save_sudb   => { String => 'save sudb', expect => $success },    save_sudb   => { String => 'save sudb', expect => $success },
   syslog      => { expect => $success },    syslog      => { expect => $success },
   'pipe'      => { }, # XXX needs a special decode    'pipe'      => { }, # XXX needs a special decode
   maclist     => { decode => 'maclist' },    maclist     => { decode => 'maclist' },
   maclist_reset => { String => 'maclist reset', expect => 'done' },    maclist_reset => { String => 'maclist reset', expect => 'done' },
   eth_link    => { String => 'eth link', expect => $success },    eth_link    => { String => 'eth link', expect => $success },
     su_info     => { String => 'su info', decode => 'all', expect => $success },
     save_ss     => { String => 'save ss', expect => $success },
   # eth r, w and reset???    # eth r, w and reset???
   #su password???    #su password???
   #_bootloader    #_bootloader
Line 329 
Line 345 
   }    }
   
   if (exists $COMMANDS{$method}) {    if (exists $COMMANDS{$method}) {
     $method = shift if (@_ == 1);  
     $COMMANDS{$method}{'String'} ||= $method;      $COMMANDS{$method}{'String'} ||= $method;
       $COMMANDS{$method}{'args'} .= ' ' . shift if (@_ == 1);
     return $self->cmd(%{ $COMMANDS{$method} }, @_);      return $self->cmd(%{ $COMMANDS{$method} }, @_);
   }    }
   
Line 860 
Line 876 
   my %conf;    my %conf;
   
   my $key = '';    my $key = '';
   my $val = '';    my $val = undef;
   my $in_key = 0;    my $in_key = 0;
   my $in_val = 0;    my $in_val = 1;
   
   foreach my $line (@lines) {    foreach my $line (@lines) {
     next if $line =~ /$success$/;      next if $line =~ /$success$/;
Line 878 
Line 894 
           $in_val = 0;            $in_val = 0;
         } else {          } else {
           $in_key = 0;            $in_key = 0;
           $in_val = 0;            $in_val = 1;
         }          }
   
         if ($key) {          if ($key) {
           $key =~ s/^\s+//;            $key =~ s/^\s+//;
           $key =~ s/\s+$//;            $key =~ s/\s+$//;
   
           $val =~ s/^\s+//;            if (defined $val) {
           $val =~ s/\s+$//;              $val =~ s/^\s+//;
               $val =~ s/\s+$//;
             }
   
           if ($key eq 'Checksum' && $last_key) {            if ($key eq 'Checksum' && $last_key) {
             # Special case for these bastids.              # Special case for these bastids.
Line 918 
Line 936 
   if (%conf) {    if (%conf) {
     return \%conf;      return \%conf;
   } else {    } else {
     return undef;      return $val;
   }    }
 }  }
   
Line 993 
Line 1011 
                                 loc  => $loc,                                  loc  => $loc,
                                 tm   => $tm,                                  tm   => $tm,
                                 suid => $suid,                                  suid => $suid,
                                 cur_tm => \$current_tm,  
                         };                          };
                 } elsif ($line =~ /(\d+)\s+entries/) {                  } elsif ($line =~ /(\d+)\s+entries/) {
                         $total_entries = $1;                          $total_entries = $1;
Line 1001 
Line 1018 
                         $current_tm = $1                          $current_tm = $1
                 }                  }
         }          }
   
           map { $_->{'cur_tm'} = $current_tm } @decoded;
   
         if (scalar @decoded == $total_entries) {          if (scalar @decoded == $total_entries) {
                 return \@decoded;                  return \@decoded;
         } else {          } else {

Legend:
Removed from v.1.14  
changed lines
  Added in v.1.18

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>