Beefy Boxes and Bandwidth Generously Provided by pair Networks Russ
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Re: validateMask (regex tweak, 30bit mask, CPAN modules)

by idnopheq (Chaplain)
on May 09, 2001 at 14:51 UTC ( [id://79106]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Re: validateMask (regex tweak, 30bit mask, CPAN modules)
in thread validateMask

THX for the comments ... I rewrote the validateMask sub, including your

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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://79106]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.