in reply to Re: validateMask (regex tweak, 30bit mask, CPAN modules)
in thread validateMask
return unless $mask =~/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/;
My new version is far simpler than my original post, using Socket, unpack, and join to give a 32 character binary string, then searching for the pattern /01/. If we find it, bad mask. Everything else then must be good ( unless someone finds a fatal flaw here, too! :b ).
I wasn't initially that excited about requiring Socket, but then I figured this will likely be used (if at all) in a networking script, so Socket.pm is ok.
--
idnopheq
Apply yourself to new problems without preparation, develop confidence in your ability to to meet situations as they arrise.
|
|---|