Turning number ranges into prefixes

bah@longitude.com bah at longitude.com
Wed Aug 23 20:08:45 BST 2006


> Maybe have a look at Net::Netmask. There's a sub in there called
> irange2cidrlist which finds the smallest number of network blocks to
> cover a given range of IP addresses which is sort of what you want.
> <waves hands madly> I presume the binary manipulation in this module can
> be munged like the above.  The code is short on comments though (ie
> none) so may be like turning a sausage back into a pig .
>
> Interesting problem though. I may ponder further ...

I suspect a fairly efficient algorithm could be coded up using
Set::IntRange (which uses Bit::Vector internally)...

Ben


More information about the london.pm mailing list