in reply to Win32::PingICMP returns odd results
The following cut down version of your script (removing the CGI component) seems to function correctly. Maybe you have a down-level version of something?
#! perl -slw use strict; use Win32::PingICMP; my $p = new Win32::PingICMP; die 'No hosts specified' unless @ARGV; print $_, ' : ', $p->ping( $_ ), ' : ', $p->details->{host}, ' : ', $p +->details->{status} for @ARGV; __END__ D:\Perl\test>ping.exe perlmonks.com Pinging perlmonks.com [209.197.123.153] with 32 bytes of data: Reply from 209.197.123.153: bytes=32 time=280ms TTL=242 Reply from 209.197.123.153: bytes=32 time=261ms TTL=242 Reply from 209.197.123.153: bytes=32 time=250ms TTL=242 Reply from 209.197.123.153: bytes=32 time=251ms TTL=242 D:\Perl\test>ping.exe 128.231.013.057 Pinging 128.231.11.47 with 32 bytes of data: Request timed out. Request timed out. Request timed out. Request timed out. D:\Perl\test>ping 128.231.013.057 209.197.123.153 "my" variable $count masks earlier declaration in same scope at d:/Per +l/site/lib/Win32/PingICMP.pm line 121. 128.231.013.057 : 0 : 128.231.013.057 : IP_REQ_TIMED_OUT 209.197.123.153 : 1 : 209.197.123.153 : IP_SUCCESS
The versions I am using are
D:\Perl\test>perl -mWin32::PingICMP -de1 Loading DB routines from perl5db.pl version 1.19 Editor support available. Enter h or `h h' for help, or `perldoc perldebug' for more help. Win32::API::Type::CODE(0x1b6af60)(d:/Perl/site/lib/Win32/API/Type.pm:4 +0): 40: my $section = 'nothing'; DB<1> M 'AutoLoader.pm' => '5.59 from d:/Perl/lib/AutoLoader.pm' 'Carp.pm' => '1.01 from d:/Perl/lib/Carp.pm' 'Carp/Heavy.pm' => 'd:/Perl/lib/Carp/Heavy.pm' 'Config.pm' => 'd:/Perl/lib/Config.pm' 'DynaLoader.pm' => '1.04 from d:/Perl/lib/DynaLoader.pm' 'Exporter.pm' => '5.566 from d:/Perl/lib/Exporter.pm' 'Term/Cap.pm' => '1.08 from d:/Perl/lib/Term/Cap.pm' 'Term/ReadLine.pm' => '1.00 from d:/Perl/lib/Term/ReadLine.pm' 'Win32/API.pm' => '0.41 from d:/Perl/site/lib/Win32/API.pm' 'Win32/API/Struct.pm' => '0.40 from d:/Perl/site/lib/Win32/API/Struct. +pm' 'Win32/API/Type.pm' => '0.40 from d:/Perl/site/lib/Win32/API/Type.pm' 'Win32/PingICMP.pm' => '0.02 from d:/Perl/site/lib/Win32/PingICMP.pm' 'perl5db.pl' => '1.19 from d:/Perl/lib/perl5db.pl' 'strict.pm' => '1.02 from d:/Perl/lib/strict.pm' 'vars.pm' => '1.01 from d:/Perl/lib/vars.pm' 'warnings.pm' => '1.00 from d:/Perl/lib/warnings.pm' 'warnings/register.pm' => '1.00 from d:/Perl/lib/warnings/register.pm' DB<1>
|
|---|