in reply to Re: Net::Ping 2.63 Failing
in thread Net::Ping 2.63 Failing

works in one version, just not in the other. Also fails on an ip address of 10.240.220.331 in version 2.63 but works in version 2.43 for the same IP address. Should it be trying to actually validate an IP address or just ping it?

Replies are listed 'Best First'.
Re^3: Net::Ping 2.63 Failing
by syphilis (Archbishop) on Jan 17, 2018 at 04:21 UTC
    Should it be trying to actually validate an IP address or just ping it?

    By my reading of the Net::Ping::ping() documentation, it should just ping it.

    That documentation says, in part:

    <quote>
    If the hostname cannot be found or there is a problem with the IP number, the success flag returned will be undef. Otherwise, the success flag will be 1 if the host is reachable and 0 if it is not. For most practical purposes, undef and 0 and can be treated as the same case.
    </quote>

    So, if the ping() function is dying, then it's not behaving as advertised - which makes it a bug.

    Cheers,
    Rob

      Agreed, any this is the point that I was trying to make. With that said, whom should I open a bug report with? I have never filed a bug report

        With that said, whom should I open a bug report with?

        Net::Ping is a part of perl core, so you can send your bug report as an email to perlbug@perl.org .
        AFTERTHOUGHT: I just noticed that perl core currently (perl-5.27.7) has Net-Ping-2.62 - so you probably should check and see what its behaviour is prior to reporting.
        UPDATE: I finally got around to checking the behaviour with Net-Ping-2.62, and it does have the same buggy behaviour as you reported for 2.63.
        Most people would file that email by running the perlbug command - as that ensures that all relevant information about your system and perl itself are included in your report

        Note that there are 2 ways that this bug could be fixed:
        1) Restore the previous behaviour of ping();
        2) Alter the documentation of ping() to match the current behaviour.
        So it's not guaranteed that the behaviour of ping() will be reverted to its earlier form.
        However, back-compatibility considerations should provide an incentive to go with 1)

        Cheers,
        Rob
Re^3: Net::Ping 2.63 Failing
by huck (Prior) on Jan 17, 2018 at 04:25 UTC

    Please explain how can you ping an invalid address? What would you fill into the 32bits of the "Destination IP address"? How do you change the ascii 991 or 331 into a 8bit binary number?

      I don't disagree with that. But is it the functionality of the module to check if the IP is in a valid rage, or it it the function of Net::Ping, to "ping" or attempt to ping, the ip address supplied? Again, at least in 2.43 version, the Net::Ping did not completely exit the running perl script. In the 2.61 & 2.63 versions, the script errors out and stops any further execution

      I don't disagree with that. But is it the functionality of the module to check if the IP is in a valid rage, or it it the function of Net::Ping, to "ping" or attempt to ping, the ip address supplied? Again, at least in 2.43 version, the Net::Ping did not completely exit the running perl script. In the 2.61 & 2.63 versions, the script errors out and stops any further execution

        BTW, in doubt and if you don't believe it you may write a test:

        #!/usr/bin/env perl use strict; use warnings; use Data::Validate::IP qw(is_ipv4); use Test::More tests => 2; my $perlmonks = q(209.197.123.153); my $nowhere = q(192.168.10.991); ok( defined( is_ipv4($perlmonks) ), qq(ipv4 $perlmonks) ); ok( defined( is_ipv4($nowhere) ), qq(ipv4 $nowhere) ); __END__ karls-mac-mini:playground karl$ ./ip.pl 1..2 ok 1 - ipv4 209.197.123.153 not ok 2 - ipv4 192.168.10.991 # Failed test 'ipv4 192.168.10.991' # at ./ip.pl line 12. # Looks like you failed 1 test of 2.

        Best regards, Karl

        «The Crux of the Biscuit is the Apostrophe»

        perl -MCrypt::CBC -E 'say Crypt::CBC->new(-key=>'kgb',-cipher=>"Blowfish")->decrypt_hex($ENV{KARL});'Help