Net::IP::AddrRanges - IP address ranges to match
use Net::IP::AddrRanges; my $ranges = Net::IP::AddrRanges->new(); $ranges->add( '192.168.0.0/24', # CIDR style '192.168.1.64/255.255.255.240', # netmask style '192.168.3.23', # single address '64::1/64', # IPv6 address range '192.168.5.23-192.168.12.3', # from-to ); $ranges->subtract('192.168.0.64/27'); # excludes this range $ranges->find('192.168.0.1'); # True $ranges->find('192.168.0.70'); # False
Net::IP::AddrRanges is to represent a list of IP address ranges.
Construct new object. any arguments are passed to add();
Adds IP address ranges to the list. this accepts single, hyphenated, netmask style and CIDR style IP address ranges.
Subtract IP address ranges from the list. this accepts same arguments as add()
add()
Finds passed IP address from the list. Returns true if found, false otherwise.
Rintaro Ishizaki <rintaro@cpan.org>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Net::IP::AddrRanges, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::IP::AddrRanges
CPAN shell
perl -MCPAN -e shell install Net::IP::AddrRanges
For more information on module installation, please visit the detailed CPAN module installation guide.