The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Farly::IPv4::Range - IPv4 range class

DESCRIPTION

This class represents an IPv4 address range.

Inherits from Farly::IPv4::Object.

METHODS

new( <string> )

The constructor accepts a dotted decimal format, or 32 bit integer format, IP address range with the first address separated from the last address by a space or dash.

 my $ip_range = Farly::IPv4::Range->new( "10.0.0.1 10.0.0.25" );
 my $ip_range = Farly::IPv4::Range->new( "10.0.0.1-10.0.0.25" );

first()

Returns the first address in the range as a 32 bit integer

  $first_32bit_int_addr = $ip_range->first();

last()

Returns the last address in the range as a 32 bit integer

  $last_32bit_int_addr = $ip_range->last();

start()

Returns the first address as an Farly::IPv4::Address object

  $ipv4_addr_object = $ip_range->start();

end()

Returns the last address as an Farly::IPv4::Address object

  $ipv4_addr_object = $ip_range->end();

as_string()

Returns the current Farly::IPv4::Range as a dotted decimal format string

  print $ip_range->as_string();

as_network()

Return an ARRAY of Farly::IPv4::Network objects containing exactly the same IP addresses as the current range.

  my @array = $ip_range->as_network();

adjacent( <Farly::IPv4::Object> )

Returns true if the other Farly::IPv4::Object's first address immediately follows the current range's last address.

  $ip_range->adjacent( $other_ipv4_object );

iter()

Returns an array containing the current Farly::IPv4::Range object.

  my @array = $ip_range->iter();

COPYRIGHT AND LICENSE

Farly::IPv4::Range Copyright (C) 2012 Trystan Johnson

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.