Skip Menu |

This queue is for tickets about the Net-Patricia CPAN distribution.

Report information
The Basics
Id: 57824
Status: resolved
Worked: 1 hour (60 min)
Priority: 0/
Queue: Net-Patricia

People
Owner: PHILIPP [...] cpan.org
Requestors: clint [...] renesys.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 1.19



Subject: Unable to specify "false" user data
Date: Tue, 25 May 2010 13:18:55 -0400
To: bug-Net-Patricia [...] rt.cpan.org
From: Clint Hepner <clint [...] renesys.com>
Bug: user data is overwritten with the CIDR prefix string if the data evaluates to false. Example: $pt = Net::Patricia->new() $pt->add('192.0.2.0', 24, 0) # Set user data to 0 $data = $pt->match('192.0.2.0', 24) # Returned user data is '192.0.2.0/24', not 0 die "Wrong data" if $data ne 0 Cause: This line in the add() and add_integer() methods: $data || = defined $bits ? "$ip/$bits" : $ip. $data will be overwritten if it is false. Proposed solution: Use an if statement modifier instead of the ||= operator $data = defined $bits ? "$ip/$bits" : $ip if @_ < 4; Problem exists in both Net::Patricia::AF_INET and Net::Patricia::AF_INET6 packages. -- Clint Hepner Renesys Corporation clint@renesys.com
Fixed in 1.19.