Net::IPAddress::Util::Range - Representation of a range of IP addresses
use Net::IPAddress::Util::Range; my $x = '192.168.0.3'; my $y = '192.168.0.123'; my $range = Net::IPAddress::Util::Range->new({ lower => $x, upper => $y }); print "$range\n"; # (192.168.0.3 .. 192.168.0.123) for (@{$range->tight()}) { print "$_\n"; } my $w = '192.168.0.0/24'; my $range = Net::IPAddress::Util::Range->new({ ip => $w }); my $v = '192.168.0.0'; my $range = Net::IPAddress::Util::Range->new({ ip => $v, cidr => 24 }); my $z = '255.255.255.0'; my $range = Net::IPAddress::Util::Range->new({ ip => $v, netmask => $z });
The constructor.
Internal use only.
Objects stringify to a representation of their range.
Stringification for CIDR-style strings.
Stringification for Netmask-style strings.
Return the bounds of the smallest subnet capable of completely containing the addresses in this range. Note that this is not automatically the same thing as "the subnet that matches this range", as a range may or may not be aligned to legal subnet boundaries.
Returns a collection of subnets that (between them) exactly match the addresses in this range. The returned object is an Net::IPAddress::Util::Collection, which can be treated as an array reference.
Get the lower or upper bounds of this range.
To install Net::IPAddress::Util, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::IPAddress::Util
CPAN shell
perl -MCPAN -e shell install Net::IPAddress::Util
For more information on module installation, please visit the detailed CPAN module installation guide.