NAME

Net::IPAddress::Util::Range - Representation of a range of IP addresses

VERSION

Version 3.020

SYNOPSIS

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 });

DESCRIPTION

CLASS METHODS

new

The constructor.

BUILD

Internal use only.

OBJECT METHODS

'""'

as_string

Objects stringify to a representation of their range.

as_cidr

Stringification for CIDR-style strings.

as_netmask

Stringification for Netmask-style strings.

outer_bounds

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.

inner_bounds

Return the bounds of the largest subnet capable of being completely contained by 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.

tight

Returns a collection of subnets that (between them) exactly match the addresses in this range. The returned object is a Net::IPAddress::Util::Collection, which can be treated as an array reference of Net::IPAddress::Util::Range objects.

loose

Returns a blessed object (of this class) representing the range returned by outer_bounds().

lower

upper

Get the lower or upper bounds of this range.