Subject: | Patch for paging and echo removal support |
--- Net-Telnet-Netscreen-1.2/lib/Net/Telnet/Netscreen.pm 2008-04-
06 15:56:40.000000000 +0100
+++ /tmp/Netscreen.pm 2010-01-20 14:26:13.000000000 +0000
@@ -10,7 +10,7 @@ package Net::Telnet::Netscreen;
#-----------------------------------------------------------------
use strict;
-use Net::Telnet 3.02;
+use Net::Telnet 3.02 qw(TELOPT_ECHO);
use Carp;
use vars qw($AUTOLOAD @ISA $VERSION);
@@ -323,14 +323,14 @@ sub scrolling_cmd {
## on the assumption that it's an echoed back command.
## FIXME: I had to uncomment this for now. Hope it doesn't
## break stuff too badly for anyone ;>
-# if ($cmd_remove_mode eq "auto") {
-# ## See if remote side told us they'd echo.
-# $telopt_echo = $self->SUPER::option_state(&TELOPT_ECHO);
-# $remove_echo = $telopt_echo->{remote_enabled};
-# }
-# else { # user explicitly told us how many lines to remove.
-# $remove_echo = $cmd_remove_mode;
-# }
+ if ($cmd_remove_mode eq "auto") {
+ ## See if remote side told us they'd echo.
+ $telopt_echo = $self->SUPER::option_state(&TELOPT_ECHO);
+ $remove_echo = $telopt_echo->{remote_enabled};
+ }
+ else { # user explicitly told us how many lines to remove.
+ $remove_echo = $cmd_remove_mode;
+ }
## Get rid of possible echo back command.
while ($remove_echo--) {
@@ -623,6 +623,23 @@ sub login {
1;
} # end sub login
+sub paging {
+ my ($self,$state) = @_;
+ return $self->error("No state specified") unless $state;
+ my @results;
+ if ($state eq 'on') {
+ @results=$self->cmd('set console page 22');
+ }
+ else {
+ @results=$self->cmd('set console page 0');
+ }
+ foreach my $result (@results) {
+ if ($result =~ /\w+/) { return $self->error($result); }
+ }
+ 1;
+} # end sub paging
+
+
#------------------------------
# Class methods
#------------------------------