Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Module for working with IP Addresses and Ranges

by DrHyde (Prior)
on Oct 25, 2010 at 09:41 UTC ( [id://867173]=note: print w/replies, xml ) Need Help??


in reply to Module for working with IP Addresses and Ranges

IMO the canonical tool for this is Net::CIDR. The interface and documentation is kinda clunky in some ways, but it works, and works very well, for both IPv4 and IPv6.
$ perl -MNet::CIDR -e ' print Net::CIDR::cidrlookup( "192.168.1.130", Net::CIDR::range2cidr("192.168.1.120-192.168.1.141") )' 1 $ perl -MNet::CIDR -e ' print Net::CIDR::cidrlookup( "192.168.1.180", Net::CIDR::range2cidr("192.168.1.120-192.168.1.141") )' 0

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://867173]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (3)
As of 2024-04-20 03:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found