| 1 | 1 | ▶ | use NetAddr::IP::Lite; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 2 | |||||||||||
| 3 | 1 | my @addr = (qw( 127.0.0.1 10.0.0.1 )); | |||||||||
| 4 | 1 | my @mask = (qw( 255.0.0.0 255.255.0.0 255.255.255.0 255.255.255.255 )); | |||||||||
| 5 | |||||||||||
| 6 | 1 | $| = 1; | |||||||||
| 7 | 1 | print "1..", (2 * scalar @addr * scalar @mask), "\n"; | |||||||||
| 8 | |||||||||||
| 9 | 1 | my $count = 1; | |||||||||
| 10 | |||||||||||
| 11 | 1 | for my $a (@addr) { | |||||||||
| 12 | 2 | for my $m (@mask) { | |||||||||
| 13 | 8 | my $ip = new NetAddr::IP::Lite $a, $m; | |||||||||
| 14 | 8 | ▶ | print (($ip->addr ne $a ? 'not ' : ''), "ok ", $count++, "\n"); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 15 | 8 | ▶ | print (($ip->mask ne $m ? 'not ' : ''), "ok ", $count++, "\n"); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 16 | } | ||||||||||
| 17 | } | ||||||||||
| 18 | |||||||||||
| 19 | |||||||||||