Net::Subnet
Net::Subnet
By Juerd Waalboer from Amsterdam.pm
Date: Saturday, 15 October 2011 17:10
Duration: 20 minutes
Target audience: Intermediate
Language: English
Tags: address bitwise closures ip operators
Writing "(inet_aton($ip) & inet_aton($mask)) eq (inet_aton($subnet) & inet_aton($mask))" is easy enough and doesn't really need a module. But with the introduction of IPv6, it became a little more complex. There are several modules that can do this, but I wanted a pure Perl solution that is also pretty fast. So I wrote Net::Subnet one afternoon, and used it in production the next day.