Subject: | Argument "" isn't numeric in numeric gt (>) at C:/Perl/site/lib/N et/Telnet.pm line 2569. |
Dist Name: Net-Telnet-3.02
Perl version: This is perl, v5.6.1 built for MSWin32-x86-multi-thread
OS: Win2K SP2
The problem can be replicated on ActiveState Perl build 630 with the following line:
Show quoted text
>C:\>perl -MNet::Telnet -w -e "$obj = Net::Telnet->new; $obj->open(Host => '127.0.0.1');"
Argument "" isn't numeric in numeric gt (>) at C:/Perl/site/lib/Net/Telnet.pm line 2569.
The problem lies in the _optimal_blksize method of the Telnet.pm module and is not related to ActiveState per se, but the manner by which this method is called from within the new initiation method. The code for the _optimal_blksize method is as follows:
sub _optimal_blksize {
my ($blksize) = @_;
return $blksize
if defined $blksize and $blksize > 0 and $blksize <= 1_048_576;
8192;
} # end sub _optimal_blksize
This method is called without any parameters from the Net::Telnet new method and as such the variable $blksize will be undefined. This rightly generates the warning in the return $blksize if defined $blksize and ... line. This is expected behaviour under -w.
A straight-forward fix for this problem under -w execution can be applied by adding the line:
sub _optimal_blksize {
my ($blksize) = @_;
$blksize ||= 0;
return $blksize
if defined $blksize and $blksize > 0 and $blksize <= 1_048_576;
8192;
} # end sub _optimal_blksize
... which can be applied as the following diff patch ...
2568d2567
< $blksize ||= 0;
As an aside note, I tested and was unable to replicate this warning with similarly versioned copies of Net::Telnet on Perl 5.6.1 on a i686-Linux system. Perhaps there is something more to this or the way by which warnings are generated?
Thanks to rob_au for generating this info.