http://qs321.pair.com?node_id=1212630


in reply to Re: This does not look like start end
in thread This does not look like start end

The problematic part is this one:

foreach my $subnet (($ip->bits() == 32)?@IPv4Subnets:@IPv6Subnets) { next if ($subnet eq ''); my @subnetInfo = split(/;/x, $subnet); if (Net::CIDR::cidrlookup($params{ip}, trim($subnetInfo[0]))) { return (1, \@subnetInfo); } }

I have also tried to rewrite it to while cycle with the same result.

my $number = 0; my @subnets = ($ip->bits() == 32)?@IPv4Subnets:@IPv6Subnets; while ($number < scalar @subnets) { my $subnet = @subnets[$number]; if ($subnet eq '') { $number++; next; } my @subnetInfo = split(/;/x, $subnet); if (Net::CIDR::cidrlookup($params{ip}, trim($subnetInfo[0]))) { return (1, \@subnetInfo); } else { $number++; } } return (0, "Could not find ip '$params{ip}' in subnets list");
Funnily enough the script worked when I had incorrect comparison operator ($subnet == '') in my code (with a lot of complaining from Perl of course)