$rv=list2NetAddr(\@inlist,\@NAobject);
Build of NetAddr object structure from a list of IPv4 addresses or address ranges. This object is passed to matchNetAddr to check if a given IP address is contained in the list.
input: array reference pointer to a list of addresses i.e. 11.22.33.44 11.22.33.0/24 11.22.33.0/255.255.255.0 11.22.33.20-11.22.33.46 11.22.33.20 - 11.22.33.46 output: Number of objects created or undef on error
The NAobject array is filled with NetAddr::IP::Lite object references.
$rv = matchNetAddr($ip,\@NAobject);
Check if an IP address appears in a list of NetAddr objects.
input: dot quad IP address, reference to NetAddr objects output: true if match else false
To install NetAddr::IP, copy and paste the appropriate command in to your terminal.
cpanm
cpanm NetAddr::IP
CPAN shell
perl -MCPAN -e shell install NetAddr::IP
For more information on module installation, please visit the detailed CPAN module installation guide.