Subject: | Problem in using 'Output => \@utput' in cmd command and terminal length |
I'm using this library since almost two year (maybe more). Today I see a strange behavior on sub cmd.
Since today we always used the command 'term length 0' before sending command to Cisco router, so it never happen to manage the 'More' prompt in case the number of line in output overcome the number of line in terminal.
The problem arise when we would like to return the output in a referenced variable with the parameter 'Output => \@output'.
I think that the problem is in the portion of code listed just after.
The * represent the point in the code to which the comment refer to
* here you pass the @_ to the super class
** here you don't pass the @_ to the super class and you lose the parameter passed.
in fact the result consist in finding in referenced output only the part of code before the first More (in the output returned you have all the code).
thanks in advance.
Giovanni
--------------------------below the portion of code.-------------------
while(1) {
# Send a space (with no newline) whenever we see a "More" prompt.
if ($need_more) {
$self->output_record_separator('');
# We saw a more prompt, so put it in the command output.
my @tmp = $self->last_prompt;
# Send the <space>, taking care not to
# discard the top line.
push @tmp, $self->SUPER::cmd(String => " ", Cmd_remove_mode => 0); **
if ($self->normalize_cmd) {
push @out, _normalize(@tmp);
} else {
push @out, @tmp;
}
} else {
$self->output_record_separator($old_ors);
push @out, $self->SUPER::cmd(@_); *
}