Subject: | Bug in Net::Ping::External under localized Win32 |
Perl v5.6.0 built for MSWin32-x86-multi-thread,
Binary build 618 provided by ActiveState Tool Corp.
Distr. Net-Ping-External-0.11
OS Windows 98 SE 4.10.2222 A
Bug happens at work under Win32 local versions, because the
external utility "ping" returns the answer in local
language. So, in the Russian version the answer
"time nnnn ms" becomes "âðåìÿ nnnn ìñ".
Therefore regular expression does not work properly in
procedure ping_win32.
sub _ping_win32 {
my %args = @_;
$args{timeout} *= 1000;
my $command = "ping -l $args{size} -n $args{count} -w $args{timeout} $args{host}";
print "$command\n" if $DEBUG;
my $result = `$command`;
Show quoted text
> return 1 if $result =~ /time?\d*ms/;
return 0;
}
For the given case I have replaced regexp as follows
Show quoted text> return 1 if $result =~ /TTL/;
Substring TTL occurs in the answer when host is alive,
and does not depend on the Windows localization.