Replace the deprecated module Net::Subnets with Net::CIDR::Lite.
This commit is contained in:
parent
5df15c6307
commit
fae8b162fa
4 changed files with 39 additions and 34 deletions
|
|
@ -25,6 +25,7 @@
|
||||||
- fixed #11247: Survey edit screen broken
|
- fixed #11247: Survey edit screen broken
|
||||||
- fixed #11246: Image.pm - Validation error
|
- fixed #11246: Image.pm - Validation error
|
||||||
- fixed #11221: wrong version of Locales::Country in testEnvironment
|
- fixed #11221: wrong version of Locales::Country in testEnvironment
|
||||||
|
- Net::Subnets has been deprecated.
|
||||||
|
|
||||||
7.8.4
|
7.8.4
|
||||||
- Fixed a compatibility problem between WRE and new Spectre code.
|
- Fixed a compatibility problem between WRE and new Spectre code.
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,10 @@ save you many hours of grief.
|
||||||
7.8.5
|
7.8.5
|
||||||
--------------------------------------------------------------------
|
--------------------------------------------------------------------
|
||||||
* WebGUI now requires Locales 0.10 or higher, to replace the deprecated
|
* WebGUI now requires Locales 0.10 or higher, to replace the deprecated
|
||||||
modules Locales::Country.
|
module Locales::Country.
|
||||||
|
|
||||||
|
* WebGUI now requires Net::CIDR::Lite 0.20 or higher, to replace the deprecated
|
||||||
|
module Net::Subnets.
|
||||||
|
|
||||||
* Users, no matter if they are created via anonymous registration,
|
* Users, no matter if they are created via anonymous registration,
|
||||||
via the Admin Console Users screen, or via code, now always get
|
via the Admin Console Users screen, or via code, now always get
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ package WebGUI::Utility;
|
||||||
use Exporter;
|
use Exporter;
|
||||||
use strict;
|
use strict;
|
||||||
use Tie::IxHash;
|
use Tie::IxHash;
|
||||||
use Net::Subnets;
|
use Net::CIDR::Lite;
|
||||||
|
|
||||||
our @ISA = qw(Exporter);
|
our @ISA = qw(Exporter);
|
||||||
our @EXPORT = qw(&isBetween &makeTabSafe &makeArrayTabSafe &randomizeHash &commify &randomizeArray &isInSubnet
|
our @EXPORT = qw(&isBetween &makeTabSafe &makeArrayTabSafe &randomizeHash &commify &randomizeArray &isInSubnet
|
||||||
|
|
@ -176,7 +176,9 @@ sub isIn {
|
||||||
|
|
||||||
=head2 isInSubnet ( ipAddress, subnets )
|
=head2 isInSubnet ( ipAddress, subnets )
|
||||||
|
|
||||||
Verifies whether an IP address is in a given subnet. Returns a 1 if it is, undef if there's a formatting error, or 0 if the IP is not in the list of subnets.
|
Verifies whether an IP address is in a given subnet. Returns a 1 if it
|
||||||
|
is, undef if there's a formatting error, or 0 if the IP is not in the
|
||||||
|
list of subnets.
|
||||||
|
|
||||||
=head3 ipAddress
|
=head3 ipAddress
|
||||||
|
|
||||||
|
|
@ -191,7 +193,7 @@ An array reference containing subnets in CIDR format. Example: 127.0.0.1/32
|
||||||
sub isInSubnet {
|
sub isInSubnet {
|
||||||
my $ip = shift;
|
my $ip = shift;
|
||||||
my $subnets = shift;
|
my $subnets = shift;
|
||||||
# some validation
|
return 0 unless @{ $subnets };
|
||||||
for my $cidr ( @{ $subnets } ) {
|
for my $cidr ( @{ $subnets } ) {
|
||||||
my @parts = $cidr =~ /^(\d+)\.(\d+)\.(\d+)\.(\d+)\/(\d+)$/;
|
my @parts = $cidr =~ /^(\d+)\.(\d+)\.(\d+)\.(\d+)\/(\d+)$/;
|
||||||
unless ( 5 == @parts ) { # cidr has 5 parts
|
unless ( 5 == @parts ) { # cidr has 5 parts
|
||||||
|
|
@ -204,9 +206,8 @@ sub isInSubnet {
|
||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
my $net = Net::Subnets->new;
|
my $net = Net::CIDR::Lite->new(@{ $subnets });
|
||||||
$net->subnets($subnets);
|
if ($net->find($ip)) {
|
||||||
if ($net->check(\$ip)) {
|
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,7 @@ checkModule("XML::FeedPP", 0.40 );
|
||||||
checkModule("JSON", 2.12 );
|
checkModule("JSON", 2.12 );
|
||||||
checkModule("Config::JSON", "1.3.1" );
|
checkModule("Config::JSON", "1.3.1" );
|
||||||
checkModule("Text::CSV_XS", "0.64" );
|
checkModule("Text::CSV_XS", "0.64" );
|
||||||
checkModule("Net::Subnets", 0.21 );
|
checkModule("Net::CIDR::Lite", 0.20 );
|
||||||
checkModule("Finance::Quote", 1.15 );
|
checkModule("Finance::Quote", 1.15 );
|
||||||
checkModule("POE", 1.005 );
|
checkModule("POE", 1.005 );
|
||||||
checkModule("POE::Component::IKC::Server", 0.2001 );
|
checkModule("POE::Component::IKC::Server", 0.2001 );
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue