Skip to content


Subversion checkout URL

You can clone with
Download ZIP


networks with invalid address/subnet mask combinations are auto-fixed #7

abraxxa opened this Issue · 6 comments

4 participants


I expected this to die:

my $net = Net::Works::Network->new_from_string( string => '' );

Instead it automagically changes the object to which is neither documented nor enables a user to detect such cases.

I'm using it to validate user input, with NetAddr::IP my code looks like this:

unless ( $netaddr_obj->addr eq $netaddr_obj->network->addr ) {}

which I tried to recreate using Net::Works.

Benchmarks currently show that Net::Works is approximately half as fast as NetAddr::IP which isn't bad without XS.


@abraxxa Have you looked into using to validate user input?


@oalders - I agree with @abraxxa that is a bug, actually. And Data::Validate::IP won't help here. It doesn't have a method to verify that something is a reasonable network specification.


If we do fix this, we might want a relaxed option that fixes subnets provided with an invalid start IP. There is a lot of messy data out there that doesn't strictly follow the standard CIDR notation.


An option is fine for me but I'd default to only accepting valid data.


Any news on this?


Doh, forgot about this. Yes, I agree that by default we should reject bad data. As far as working on it, a PR would be welcome. I don't know that we have plans to schedule this during my work time (this module is mostly maintained on the clock for me).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.