Subject: | Broken named parameter handling |
Hi,
The Net::Telnet::Cisco manual lists the following as a valid named
parameter to new():
$session = Net::Telnet::Cisco->new(
[Autopage => $boolean,] # 1
etc...
However, due to the design of Net::Telnet::Cisco::new() the "Autopage"
parameter can never be used, and this is the result if you try:
$ perl -MNet::Telnet::Cisco \
-e 'my $s = Net::Telnet::Cisco->new(Autopage => 0);'
bad named parameter "Autopage" given to Net::Telnet::Cisco::new()...
This is because new() calls Net::Telnet::new() *before* parsing its own
parameters, and Net::Telnet is designed to die on unkown parameters. In
that case, Net::Telnet::Cisco can never parse this named parameter, so I
doubt that this code has ever been tested.
If the author of Net::Telnet::Cisco believes this to be a bug in
Net::Telnet rather than his own module then he is welcome to resolve
this ticket and raise a bug against that module instead.
One solution might be to parse and strip known parameters from the named
parameter list before passing the remaining parameters to
$self->SUPER::new().
Another solution might be to remove support for the "Autopage" named
parameter and just have the user call ->autopage() after initialization.
regards,
oliver.