kamesh3183 has asked for the wisdom of the Perl Monks concerning the following question:
Could you please tell is there any module on CPAN that can do this thing?my $V_IP = new Net::IP('81.0.0.0 - 84.23.45.67') or die( Net::IP::Erro +r() ); my $G_IP = new Net::IP('80.60.80.120 - 85.34.45.56') or die( Net::IP:: +Error() ); my $V_Match = $G_IP->overlaps($V_IP); if (not defined($V_Match)) { print "Problem with IP range\n"; } elsif ( $V_Match == $IP_IDENTICAL ) { print $G_IP->print(), ' is identical with the range ', $V_ +IP->print(), "\n"; } elsif ( $V_Match == $IP_A_IN_B_OVERLAP ) { print $V_IP->print(), ' contains the range ', $G_IP->print +(), "\n"; } elsif ( $V_Match == $IP_B_IN_A_OVERLAP ) { print $G_IP->print(), ' contains the range ', $V_IP->print +(), "\n"; } elsif ( $V_Match == $IP_PARTIAL_OVERLAP ) { print $G_IP->print(), ' partially overlaps with the range +', $V_IP->print(), "\n"; } elsif ( $V_Match == $IP_NO_OVERLAP ) { print $V_IP->print(), ' doesnot overlap with ', $G_IP->pri +nt(), "\n"; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Splitting IP ranges depending on overlap conditions
by kvale (Monsignor) on Apr 14, 2006 at 15:35 UTC | |
Re: Splitting IP ranges depending on overlap conditions
by eXile (Priest) on Apr 14, 2006 at 15:26 UTC | |
by fishbot_v2 (Chaplain) on Apr 14, 2006 at 17:49 UTC |