blib/lib/Ipv4_networks.pm

filter: Statementstmt 10.6% 18 / 169 Branchbran 0.0% 0 / 78 Conditioncond 0.0% 0 / 72 MC/DCmcdc 0.0% 0 / 48 Subroutinesub 21.4% 3 / 14 Podpod 0.0% 0 / 11 totaltotal 5.3% 21 / 392 CC 70 SCAR 72.9
CC
70
Cov
6%
trasforma
2450.0
class_a
90.0
class_b
30.0
CRAP 1459.4
↑ Summary
1 package Ipv4_networks;
2 1 ▶use 5.006001;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 require Exporter;
6 1 our @ISA = qw(Exporter);
7 1 our %EXPORT_TAGS = ('all' => [ qw(new class_a class_b class_c)]);
8 1 our @EXPORT_OK = (@{$EXPORT_TAGS{'all'}});
9 1 our @EXPORT = qw();
10 1 our $VERSION = '0.1';
11 #####################################################
12 1 my @network = qw - 128 192 224 240 248 252 254 255 -;
13 1 my ($class, $this, @class_a, @class_b, @class_c);
14 #####################################################
15 0 ▶sub new {
Subroutine new: not called CC=2 SCAR=17.9
Pod undocumented
16 0 ▶ $class = shift or die $!;
Branch: 1 branch
BranchTrueFalseTotal
$class = shift() or die $! 0 0 0
17 0 $this = {};
18 0 bless $this, $class;
19 0 return $this;
20 }
21 #####################################################
22 #Public
23 0 ▶sub class_a{
Subroutine class_a: not called CC=9 SCAR=45.0
Pod undocumented
24 0 ▶ $this = shift or die $!;
Branch: 1 branch
BranchTrueFalseTotal
$this = shift() or die $! 0 0 0
25 0 ▶ $this->{ip} = shift or die $!;
Branch: 1 branch
BranchTrueFalseTotal
$this->{"ip"} = shift() or die $! 0 0 0
26 0 foreach (@network){
27 0 secondo($_);
28 }
29 0 foreach (@network){
30 0 ▶ for (my$i=0; $i<256;$i++){
Branch: 1 branch
BranchTrueFalseTotal
if ($i < 256) 0 0 0
31 0 secondo_terzo($i,$_);
32 }
33 }
34 0 foreach (@network){
35 0 ▶ for (my$i=0; $i<256;$i++){
Branch: 1 branch
BranchTrueFalseTotal
if ($i < 256) 0 0 0
36 0 ▶ for (my$i2=0; $i2<256;$i2++){
Branch: 1 branch
BranchTrueFalseTotal
if ($i2 < 256) 0 0 0
37 0 secondo_terzo_quarto($i,$i2,$_);
38 }
39 }
40 }
41 #no push and return, or memory problems.
42 }
43 #Public
44 0 ▶sub class_b{
Subroutine class_b: not called CC=5 SCAR=34.0
Pod undocumented
45 0 $this = shift;
46 0 ▶ $this->{ip} = shift or die $!;
Branch: 1 branch
BranchTrueFalseTotal
$this->{"ip"} = shift() or die $! 0 0 0
47 0 foreach (@network){
48 0 terzo($_);
49 }
50 0 foreach (@network){
51 0 ▶ for (my$i = 0; $i <256; $i++){
Branch: 1 branch
BranchTrueFalseTotal
if ($i < 256) 0 0 0
52 0 terzo_quarto($i,$_);
53 }
54 }
55 0 return @class_b;
56 }
57 #Public
58 0 ▶sub class_c{
Subroutine class_c: not called CC=3 SCAR=24.8
Pod undocumented
59 0 $this = shift;
60 0 ▶ $this->{ip} = shift or die $!;
Branch: 1 branch
BranchTrueFalseTotal
$this->{"ip"} = shift() or die $! 0 0 0
61 0 foreach (@network){
62 0 quarto($_);
63 }
64 0 return @class_c;
65 }
66 ##################################################################################################
67 #Private
68 0 ▶sub secondo{
Subroutine secondo: not called CC=2 SCAR=17.9
Pod undocumented
69 0 my$n = shift;
70 0 my@split = split /\./, $this->{ip};
71 0 my$terminale = trasforma($n, 'secondo');
72 0 my$magic = 256;
73 0 my$blocchida = $magic-$n;
74 0 my$numeroblocchi = $magic/$blocchida;
75 0 my$salto = 0;
76 0 my$a = "$split[0]."; my$b = "$salto.0.0/$terminale";
77 0 push @class_a, $a.$b;
78 0 print $a.$b."\n";
79 0 ▶ for (my$x = 1; $x<$numeroblocchi; $x++){
Branch: 1 branch
BranchTrueFalseTotal
if ($x < $numeroblocchi) 0 0 0
80 0 my$c = "$split[0]."; my$d = $salto+=$blocchida; my$e = ".0.0/$terminale";
81 0 print $c.$d.$e."\n";
82 }
83 }
84 #Private
85 0 ▶sub secondo_terzo{
Subroutine secondo_terzo: not called CC=2 SCAR=17.9
Pod undocumented
86 0 my$first = shift;
87 0 my$n = shift;
88 0 my@split = split /\./, $this->{ip};
89 0 my$terminale = trasforma($n, 'terzo');
90 0 my$magic = 256;
91 0 my$blocchida = $magic-$n;
92 0 my$numeroblocchi = $magic/$blocchida;
93 0 my$salto = 0;
94 0 $a = "$split[0].$first.$salto.0/$terminale";
95 0 print $a."\n";
96 0 ▶ for (my$x = 1; $x<$numeroblocchi; $x++){
Branch: 1 branch
BranchTrueFalseTotal
if ($x < $numeroblocchi) 0 0 0
97 0 my$b = "$split[0]."; my$c = "$first."; my$d = $salto+=$blocchida; my$e = ".0/$terminale";
98 0 print $b.$c.$d.$e."\n";
99 }
100
101 }
102 #Private
103 0 ▶sub secondo_terzo_quarto{
Subroutine secondo_terzo_quarto: not called CC=2 SCAR=17.9
Pod undocumented
104 0 my$first = shift;
105 0 my$second = shift;
106 0 my$n = shift;
107 0 my@split = split /\./, $this->{ip};
108 0 my$terminale = trasforma($n, 'quarto');
109 0 my$magic = 256;
110 0 my$blocchida = $magic-$n;
111 0 my$numeroblocchi = $magic/$blocchida;
112 0 my$salto = 0;
113 0 my$a = "$split[0].$first.$second.$salto/$terminale";
114 0 print $a."\n";
115 0 ▶ for (my$x = 1; $x<$numeroblocchi; $x++){
Branch: 1 branch
BranchTrueFalseTotal
if ($x < $numeroblocchi) 0 0 0
116 0 my$b = "$split[0]."; my$c = "$first.$second."; my$d = $salto+=$blocchida; my$e = "/$terminale";
117 0 print $b.$c.$d.$e."\n";
118 }
119 }
120 #Private
121 0 ▶sub terzo{
Subroutine terzo: not called CC=2 SCAR=17.9
Pod undocumented
122 0 my$n = shift;
123 0 my@split = split /\./, $this->{ip};
124 0 my$terminale = trasforma($n, 'terzo');
125 0 my$magic = 256;
126 0 my$blocchida = $magic-$n;
127 0 my$numeroblocchi = $magic/$blocchida;
128 0 my$salto = 0;
129 0 my$a = "$split[0].$split[1]."; my$b = "$salto.0/$terminale";
130 0 push @class_b, $a.$b;
131 0 ▶ for (my$x = 1; $x<$numeroblocchi; $x++){
Branch: 1 branch
BranchTrueFalseTotal
if ($x < $numeroblocchi) 0 0 0
132 0 my$c = "$split[0].$split[1]."; my$d = $salto+=$blocchida; my$e = ".0/$terminale";
133 0 push @class_b, $c.$d.$e;
134 }
135 }
136 #Private
137 0 ▶sub terzo_quarto{
Subroutine terzo_quarto: not called CC=2 SCAR=17.9
Pod undocumented
138 0 my$first = shift;
139 0 my$n = shift;
140 0 my@split = split /\./, $this->{ip};
141 0 my$terminale = trasforma($n, 'quarto');
142 0 my$magic = 256;
143 0 my$blocchida = $magic-$n;
144 0 my$numeroblocchi = $magic/$blocchida;
145 0 my$salto = 0;
146 0 my$a = "$split[0].$split[1].$first.$salto/$terminale";
147 0 push @class_b, $a;
148 0 ▶ for (my$x = 1; $x<$numeroblocchi; $x++){
Branch: 1 branch
BranchTrueFalseTotal
if ($x < $numeroblocchi) 0 0 0
149 0 my$b = "$split[0].$split[1]."; my$c = "$first."; my$d = $salto+=$blocchida; my$e = "/$terminale";
150 0 push @class_b, $b.$c.$d.$e;
151 }
152 }
153 #Private
154 0 ▶sub quarto {
Subroutine quarto: not called CC=2 SCAR=17.9
Pod undocumented
155 0 my$n = shift;
156 0 my@split = split /\./, $this->{ip};
157 0 my$terminale = trasforma($n, 'quarto');
158 0 my$magic = 256;
159 0 my$blocchida = $magic-$n;
160 0 my$numeroblocchi = $magic/$blocchida;
161 0 my$salto = 0;
162 0 my$a = "$split[0].$split[1]."; $b = "$split[2].0/$terminale";
163 0 push @class_c, $a.$b;
164 0 ▶ for (my$x = 1; $x<$numeroblocchi; $x++){
Branch: 1 branch
BranchTrueFalseTotal
if ($x < $numeroblocchi) 0 0 0
165 0 my$c = "$split[0].$split[1].$split[2]."; my$d = $salto+=$blocchida; my$e = "/$terminale";
166 0 push @class_c, $c.$d.$e;
167 }
168 }
169 #Private
170 0 ▶sub trasforma{
Subroutine trasforma: not called CC=49 SCAR=78.0
Pod undocumented
171 0 my$n = shift;
172 0 my$metodo = shift;
173 0 my $terminale;
174 0 ▶ $terminale = 9 if $n == 128 and $metodo eq 'secondo';
Branch: 1 branch
BranchTrueFalseTotal
if $n == 128 and $metodo eq "secondo" 0 0 0
Condition0%0/3
$n == 128 and $metodo eq "secondo"
!ll&&!rl&&r
000
MC/DC0%0/2
$n == 128 and $metodo eq "secondo"
$n == 128 $metodo eq "secondo"
Truth table0%0/3
A and B
A= $n == 128B= $metodo eq "secondo"
ABresult
0X0
100
111
175 0 ▶ $terminale = 10 if $n == 192 and $metodo eq 'secondo';
Branch: 1 branch
BranchTrueFalseTotal
if $n == 192 and $metodo eq "secondo" 0 0 0
Condition0%0/3
$n == 192 and $metodo eq "secondo"
!ll&&!rl&&r
000
MC/DC0%0/2
$n == 192 and $metodo eq "secondo"
$n == 192 $metodo eq "secondo"
Truth table0%0/3
A and B
A= $n == 192B= $metodo eq "secondo"
ABresult
0X0
100
111
176 0 ▶ $terminale = 11 if $n == 224 and $metodo eq 'secondo';
Branch: 1 branch
BranchTrueFalseTotal
if $n == 224 and $metodo eq "secondo" 0 0 0
Condition0%0/3
$n == 224 and $metodo eq "secondo"
!ll&&!rl&&r
000
MC/DC0%0/2
$n == 224 and $metodo eq "secondo"
$n == 224 $metodo eq "secondo"
Truth table0%0/3
A and B
A= $n == 224B= $metodo eq "secondo"
ABresult
0X0
100
111
177 0 ▶ $terminale = 12 if $n == 240 and $metodo eq 'secondo';
Branch: 1 branch
BranchTrueFalseTotal
if $n == 240 and $metodo eq "secondo" 0 0 0
Condition0%0/3
$n == 240 and $metodo eq "secondo"
!ll&&!rl&&r
000
MC/DC0%0/2
$n == 240 and $metodo eq "secondo"
$n == 240 $metodo eq "secondo"
Truth table0%0/3
A and B
A= $n == 240B= $metodo eq "secondo"
ABresult
0X0
100
111
178 0 ▶ $terminale = 13 if $n == 248 and $metodo eq 'secondo';
Branch: 1 branch
BranchTrueFalseTotal
if $n == 248 and $metodo eq "secondo" 0 0 0
Condition0%0/3
$n == 248 and $metodo eq "secondo"
!ll&&!rl&&r
000
MC/DC0%0/2
$n == 248 and $metodo eq "secondo"
$n == 248 $metodo eq "secondo"
Truth table0%0/3
A and B
A= $n == 248B= $metodo eq "secondo"
ABresult
0X0
100
111
179 0 ▶ $terminale = 14 if $n == 252 and $metodo eq 'secondo';
Branch: 1 branch
BranchTrueFalseTotal
if $n == 252 and $metodo eq "secondo" 0 0 0
Condition0%0/3
$n == 252 and $metodo eq "secondo"
!ll&&!rl&&r
000
MC/DC0%0/2
$n == 252 and $metodo eq "secondo"
$n == 252 $metodo eq "secondo"
Truth table0%0/3
A and B
A= $n == 252B= $metodo eq "secondo"
ABresult
0X0
100
111
180 0 ▶ $terminale = 15 if $n == 254 and $metodo eq 'secondo';
Branch: 1 branch
BranchTrueFalseTotal
if $n == 254 and $metodo eq "secondo" 0 0 0
Condition0%0/3
$n == 254 and $metodo eq "secondo"
!ll&&!rl&&r
000
MC/DC0%0/2
$n == 254 and $metodo eq "secondo"
$n == 254 $metodo eq "secondo"
Truth table0%0/3
A and B
A= $n == 254B= $metodo eq "secondo"
ABresult
0X0
100
111
181 0 ▶ $terminale = 16 if $n == 255 and $metodo eq 'secondo';
Branch: 1 branch
BranchTrueFalseTotal
if $n == 255 and $metodo eq "secondo" 0 0 0
Condition0%0/3
$n == 255 and $metodo eq "secondo"
!ll&&!rl&&r
000
MC/DC0%0/2
$n == 255 and $metodo eq "secondo"
$n == 255 $metodo eq "secondo"
Truth table0%0/3
A and B
A= $n == 255B= $metodo eq "secondo"
ABresult
0X0
100
111
182 0 ▶ $terminale = 17 if $n == 128 and $metodo eq 'terzo';
Branch: 1 branch
BranchTrueFalseTotal
if $n == 128 and $metodo eq "terzo" 0 0 0
Condition0%0/3
$n == 128 and $metodo eq "terzo"
!ll&&!rl&&r
000
MC/DC0%0/2
$n == 128 and $metodo eq "terzo"
$n == 128 $metodo eq "terzo"
Truth table0%0/3
A and B
A= $n == 128B= $metodo eq "terzo"
ABresult
0X0
100
111
183 0 ▶ $terminale = 18 if $n == 192 and $metodo eq 'terzo';
Branch: 1 branch
BranchTrueFalseTotal
if $n == 192 and $metodo eq "terzo" 0 0 0
Condition0%0/3
$n == 192 and $metodo eq "terzo"
!ll&&!rl&&r
000
MC/DC0%0/2
$n == 192 and $metodo eq "terzo"
$n == 192 $metodo eq "terzo"
Truth table0%0/3
A and B
A= $n == 192B= $metodo eq "terzo"
ABresult
0X0
100
111
184 0 ▶ $terminale = 19 if $n == 224 and $metodo eq 'terzo';
Branch: 1 branch
BranchTrueFalseTotal
if $n == 224 and $metodo eq "terzo" 0 0 0
Condition0%0/3
$n == 224 and $metodo eq "terzo"
!ll&&!rl&&r
000
MC/DC0%0/2
$n == 224 and $metodo eq "terzo"
$n == 224 $metodo eq "terzo"
Truth table0%0/3
A and B
A= $n == 224B= $metodo eq "terzo"
ABresult
0X0
100
111
185 0 ▶ $terminale = 20 if $n == 240 and $metodo eq 'terzo';
Branch: 1 branch
BranchTrueFalseTotal
if $n == 240 and $metodo eq "terzo" 0 0 0
Condition0%0/3
$n == 240 and $metodo eq "terzo"
!ll&&!rl&&r
000
MC/DC0%0/2
$n == 240 and $metodo eq "terzo"
$n == 240 $metodo eq "terzo"
Truth table0%0/3
A and B
A= $n == 240B= $metodo eq "terzo"
ABresult
0X0
100
111
186 0 ▶ $terminale = 21 if $n == 248 and $metodo eq 'terzo';
Branch: 1 branch
BranchTrueFalseTotal
if $n == 248 and $metodo eq "terzo" 0 0 0
Condition0%0/3
$n == 248 and $metodo eq "terzo"
!ll&&!rl&&r
000
MC/DC0%0/2
$n == 248 and $metodo eq "terzo"
$n == 248 $metodo eq "terzo"
Truth table0%0/3
A and B
A= $n == 248B= $metodo eq "terzo"
ABresult
0X0
100
111
187 0 ▶ $terminale = 22 if $n == 252 and $metodo eq 'terzo';
Branch: 1 branch
BranchTrueFalseTotal
if $n == 252 and $metodo eq "terzo" 0 0 0
Condition0%0/3
$n == 252 and $metodo eq "terzo"
!ll&&!rl&&r
000
MC/DC0%0/2
$n == 252 and $metodo eq "terzo"
$n == 252 $metodo eq "terzo"
Truth table0%0/3
A and B
A= $n == 252B= $metodo eq "terzo"
ABresult
0X0
100
111
188 0 ▶ $terminale = 23 if $n == 254 and $metodo eq 'terzo';
Branch: 1 branch
BranchTrueFalseTotal
if $n == 254 and $metodo eq "terzo" 0 0 0
Condition0%0/3
$n == 254 and $metodo eq "terzo"
!ll&&!rl&&r
000
MC/DC0%0/2
$n == 254 and $metodo eq "terzo"
$n == 254 $metodo eq "terzo"
Truth table0%0/3
A and B
A= $n == 254B= $metodo eq "terzo"
ABresult
0X0
100
111
189 0 ▶ $terminale = 24 if $n == 255 and $metodo eq 'terzo';
Branch: 1 branch
BranchTrueFalseTotal
if $n == 255 and $metodo eq "terzo" 0 0 0
Condition0%0/3
$n == 255 and $metodo eq "terzo"
!ll&&!rl&&r
000
MC/DC0%0/2
$n == 255 and $metodo eq "terzo"
$n == 255 $metodo eq "terzo"
Truth table0%0/3
A and B
A= $n == 255B= $metodo eq "terzo"
ABresult
0X0
100
111
190 0 ▶ $terminale = 25 if $n == 128 and $metodo eq 'quarto';
Branch: 1 branch
BranchTrueFalseTotal
if $n == 128 and $metodo eq "quarto" 0 0 0
Condition0%0/3
$n == 128 and $metodo eq "quarto"
!ll&&!rl&&r
000
MC/DC0%0/2
$n == 128 and $metodo eq "quarto"
$n == 128 $metodo eq "quarto"
Truth table0%0/3
A and B
A= $n == 128B= $metodo eq "quarto"
ABresult
0X0
100
111
191 0 ▶ $terminale = 26 if $n == 192 and $metodo eq 'quarto';
Branch: 1 branch
BranchTrueFalseTotal
if $n == 192 and $metodo eq "quarto" 0 0 0
Condition0%0/3
$n == 192 and $metodo eq "quarto"
!ll&&!rl&&r
000
MC/DC0%0/2
$n == 192 and $metodo eq "quarto"
$n == 192 $metodo eq "quarto"
Truth table0%0/3
A and B
A= $n == 192B= $metodo eq "quarto"
ABresult
0X0
100
111
192 0 ▶ $terminale = 27 if $n == 224 and $metodo eq 'quarto';
Branch: 1 branch
BranchTrueFalseTotal
if $n == 224 and $metodo eq "quarto" 0 0 0
Condition0%0/3
$n == 224 and $metodo eq "quarto"
!ll&&!rl&&r
000
MC/DC0%0/2
$n == 224 and $metodo eq "quarto"
$n == 224 $metodo eq "quarto"
Truth table0%0/3
A and B
A= $n == 224B= $metodo eq "quarto"
ABresult
0X0
100
111
193 0 ▶ $terminale = 28 if $n == 240 and $metodo eq 'quarto';
Branch: 1 branch
BranchTrueFalseTotal
if $n == 240 and $metodo eq "quarto" 0 0 0
Condition0%0/3
$n == 240 and $metodo eq "quarto"
!ll&&!rl&&r
000
MC/DC0%0/2
$n == 240 and $metodo eq "quarto"
$n == 240 $metodo eq "quarto"
Truth table0%0/3
A and B
A= $n == 240B= $metodo eq "quarto"
ABresult
0X0
100
111
194 0 ▶ $terminale = 29 if $n == 248 and $metodo eq 'quarto';
Branch: 1 branch
BranchTrueFalseTotal
if $n == 248 and $metodo eq "quarto" 0 0 0
Condition0%0/3
$n == 248 and $metodo eq "quarto"
!ll&&!rl&&r
000
MC/DC0%0/2
$n == 248 and $metodo eq "quarto"
$n == 248 $metodo eq "quarto"
Truth table0%0/3
A and B
A= $n == 248B= $metodo eq "quarto"
ABresult
0X0
100
111
195 0 ▶ $terminale = 30 if $n == 252 and $metodo eq 'quarto';
Branch: 1 branch
BranchTrueFalseTotal
if $n == 252 and $metodo eq "quarto" 0 0 0
Condition0%0/3
$n == 252 and $metodo eq "quarto"
!ll&&!rl&&r
000
MC/DC0%0/2
$n == 252 and $metodo eq "quarto"
$n == 252 $metodo eq "quarto"
Truth table0%0/3
A and B
A= $n == 252B= $metodo eq "quarto"
ABresult
0X0
100
111
196 0 ▶ $terminale = 31 if $n == 254 and $metodo eq 'quarto';
Branch: 1 branch
BranchTrueFalseTotal
if $n == 254 and $metodo eq "quarto" 0 0 0
Condition0%0/3
$n == 254 and $metodo eq "quarto"
!ll&&!rl&&r
000
MC/DC0%0/2
$n == 254 and $metodo eq "quarto"
$n == 254 $metodo eq "quarto"
Truth table0%0/3
A and B
A= $n == 254B= $metodo eq "quarto"
ABresult
0X0
100
111
197 0 ▶ $terminale = 32 if $n == 255 and $metodo eq 'quarto';
Branch: 1 branch
BranchTrueFalseTotal
if $n == 255 and $metodo eq "quarto" 0 0 0
Condition0%0/3
$n == 255 and $metodo eq "quarto"
!ll&&!rl&&r
000
MC/DC0%0/2
$n == 255 and $metodo eq "quarto"
$n == 255 $metodo eq "quarto"
Truth table0%0/3
A and B
A= $n == 255B= $metodo eq "quarto"
ABresult
0X0
100
111
198 0 return $terminale;
199 }
200 1 return 1;
201  
202 __END__
↑ Summary