in reply to Solution to broken Net::Ping

#!/usr/bin/perl use strict; use warnings; use Net::Ping; my $target = 'perlmonks.org'; my $ping_obj = Net::Ping->new(); print "Net::Ping version is $Net::Ping::VERSION\n"; if ($ping_obj->ping($target)) { print "Yes, I can ping $target\n"; } else { print "No, I cannot ping $target\n"; }

Prints:

Net::Ping version is 2.36 Yes, I can ping perlmonks.org

for me. Are you sure your target is reachable?

True laziness is hard work

Replies are listed 'Best First'.
Re^2: Solution to broken Net::Ping
by solignis (Initiate) on Dec 16, 2011 at 08:21 UTC
    I am very sure it is reachable, I am connected to the server 2 different ways. 1. The VMware client, 2. puTTY from my Windows box.
Re^2: Solution to broken Net::Ping
by solignis (Initiate) on Dec 16, 2011 at 08:26 UTC
    What OS are you using? If Linux what version? What version of perl are you using? I feel like it has to be something wrong with my machine(s) now. I tried using my own script to ping google.com and I STILL got a failure.

      When I first posted I used Windows XP with Perl 5.10.1. I've just tried with Perl 5.10.0 in a Debian lenny VM.

      What happens when you try the same ping from the command line?

      True laziness is hard work
        It works fine, that is the odd part. You would think if it failed in perl it should fail in command line but it does not.