Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: This does not look like start end

by jimpudar (Pilgrim)
on Apr 10, 2018 at 08:24 UTC ( #1212629=note: print w/replies, xml ) Need Help??


in reply to This does not look like start end

I don't think we have enough information to help you here. Is it possible for you to post the script?

It is usually helpful to distill your script down to the bare minimum amount of code which still exhibits your bug.

Also, if you add use strict and use warnings to the top of your script you might get some clues from Perl itself.

Jim

Replies are listed 'Best First'.
Re^2: This does not look like start end
by Anonymous Monk on Apr 10, 2018 at 08:33 UTC

    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)

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (4)
As of 2020-10-01 23:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (25 votes). Check out past polls.

    Notices?