Subject: | Documentation error for Net-CIDR-Lookup |
Date: | Fri, 15 Jan 2016 14:52:28 -0500 |
To: | bug-Net-CIDR-Lookup [...] rt.cpan.org |
From: | "J.D. Baldwin" <baldwin [...] panix.com> |
Hello, I have noticed a small error in the documentation for
Net-CIDR-Lookup. This caused me a small amount of confusion until I
realized the error.
Here is some of the example code under the SYNOPSIS section:
1 use Net::CIDR::Lookup;
2
3 $cidr = Net::CIDR::Lookup->new;
4 $cidr->add("192.168.42.0/24",1); # Add first network, value 1
5 $cidr->add_num(167772448,27,2); # 10.0.1.32/27 => 2
6 $cidr->add("192.168.43.0/24",1); # Automatic coalescing to a /23
7 $cidr->add("192.168.41.0/24",2); # Stays separate due to different value
8 $cidr->add("192.168.42.128/25",2); # Error: overlaps with different value
9
10 $val = $h->lookup("192.168.41.123"); # => 2
11
12 $h = $cidr->to_hash; # Convert tree to a hash
The $h variable in line 10 is out of place. It has not been
previously defined. In line 12, it is defined as the result of a
conversion to hash -- but obviously a hash is not a Net-CIDR-Lookup
object.
Changing line 10 to
$val = $cidr->lookup("192.168.41.123"); # => 2
conveys the actual meaning and fixes the confusing error.
I hope this is helpful to you and others.
jd