blib/lib/Net/ASN.pm

filter: Statementstmt 92.7% 193 / 208 Branchbran 72.0% 72 / 100 Conditioncond 52.9% 27 / 51 MC/DCmcdc 16.0% 4 / 25 Subroutinesub 100% 32 / 32 Podpod 100% 16 / 16 totaltotal 79.6% 344 / 432 CC 71 SCAR 24.1
CC
71
Cov
81%
_parseasn
39.2
toasplain16
7.4
toasdot
7.0
CRAP 11.1
↑ Summary
1 # ASN.pm - Perl module to manipulate autonomous system numbers
2 #
3 # Author: David J. Freedman <lochii AT convergence DOT cx>
4 #
5 # Copyright (C) 2008 Convergence Inc.
6 #
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms as perl itself.
9 #
10  
11 package Net::ASN;
12  
13 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 1 ▶use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 1 require Exporter;
19  
20 1 @ISA = qw(Exporter);
21  
22 1 @EXPORT = qw();
23  
24 1 %EXPORT_TAGS = (
25 all => [qw{
26 plaintodot plaintodotplus
27 dottodotplus dottoplain
28 dottoplain16 dotplustodot
29 dotplustoplain dotplustoplain16
30 isprivateasn
31 } ],
32 );
33  
34 1 @EXPORT_OK = qw();
35  
36 1 Exporter::export_ok_tags('all');
37  
38 1 $VERSION = '1.08';
39 }
40  
41 # Preloaded methods go here.
42 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
43  
44 #Constants
45 1 ▶use constant AS_TRANS => 23456;
Subroutine BEGIN: called CC=1 SCAR=0.0
46 1 ▶use constant AS16_START => 1;
Subroutine BEGIN: called CC=1 SCAR=0.0
47 1 ▶use constant AS16_PRIVATE_START => 64512;
Subroutine BEGIN: called CC=1 SCAR=0.0
48 1 ▶use constant AS16_PRIVATE_END => 65534;
Subroutine BEGIN: called CC=1 SCAR=0.0
49 1 ▶use constant AS16_END => 65535;
Subroutine BEGIN: called CC=1 SCAR=0.0
50 1 ▶use constant AS32_START => 65536;
Subroutine BEGIN: called CC=1 SCAR=0.0
51 1 ▶use constant AS32_PRIVATE_START => 4200000000;
Subroutine BEGIN: called CC=1 SCAR=0.0
52 1 ▶use constant AS32_PRIVATE_END => 4294967294;
Subroutine BEGIN: called CC=1 SCAR=0.0
53 1 ▶use constant AS32_END => 4294967295;
Subroutine BEGIN: called CC=1 SCAR=0.0
54  
55 ##OO Methods
56  
57 #Initialise with an ASN
58 #
59 30 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod documented
60  
61 30 my $class = shift;
62 30 my $self = {};
63  
64 30 my $asn = shift;
65  
66 30 my $asasdot = shift;
67  
68 30 bless $self, $class;
69  
70 30 $self->_parseasn($asn,$asasdot); #Parse the ASN
71  
72 30 return $self;
73  
74 }
75  
76 #Parses an ASN, in any format
77 30 ▶sub _parseasn ($;$) {
Subroutine _parseasn: called CC=20 SCAR=36.7
78  
79 30 my $self = shift;
80 30 my $inasn = shift;
81 30 my $asasdot = shift;
82  
83 #Perform some basic checks
84 #
85 #1) did we even get a parameter?
86 30 ▶ unless ($inasn) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($inasn) 0 30 30
87 0 croak __PACKAGE__, ": ASN not provided";
88 }
89 #2) does the ASN contain a valid character set?
90 30 ▶ unless ($inasn=~m/^[\d\.]+$/) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($inasn =~ /^[\d\.]+$/) 0 30 30
91 0 croak __PACKAGE__, ": Invalid ASN (Illegal Characters)";
92 }
93 #3) Next, check the format
94  
95 30 ▶ if ($inasn=~m/^(\d+)$/) { #ASN is ASN16 (1-65535) or ASN32 ASPLAIN (1-4294967295) or ASDOT if forced
Branch: 2 branches
BranchTrueFalseTotal
if ($inasn =~ /^(\d+)$/) { } 18 12 30
elsif ($inasn =~ /^(\d+)\.(\d+)$/) { } 12 0 12
96 18 ▶ if ($asasdot) {
Branch: 3 branches
BranchTrueFalseTotal
if ($asasdot) { } 4 14 18
elsif ($inasn >= 1 and $inasn <= 65535) { } 7 7 14
elsif ($inasn >= 65536 and $inasn <= 4294967295) { } 7 0 7
97 4 ▶ if ($inasn >= AS16_START && $inasn <= AS16_END) {
Branch: 1 branch
BranchTrueFalseTotal
if ($inasn >= 1 and $inasn <= 65535) { } 4 0 4
Condition33%1/3
$inasn >= 1 and $inasn <= 65535
!ll&&!rl&&r
004
MC/DC0%0/2
$inasn >= 1 and $inasn <= 65535
$inasn >= 1 $inasn <= 65535
Truth table33%1/3
A and B
A= $inasn >= 1B= $inasn <= 65535
ABresult
0X0
100
111
98 4 $self->{_informat} = 'asdot';
99 4 $self->{_asdot} = $inasn;
100 }
101 else {
102 0 croak __PACKAGE__, ": Invalid ASDOT ASN (ASDOT does NOT permit ASPLAIN notation for ASNs 63356-4294967295)";
103 }
104 }
105 ▶ elsif ($inasn >= AS16_START && $inasn <= AS16_END) {
Condition66%2/3
$inasn >= 1 and $inasn <= 65535
!ll&&!rl&&r
077
MC/DC50%1/2
$inasn >= 1 and $inasn <= 65535
$inasn >= 1 $inasn <= 65535
Truth table66%2/3
A and B
A= $inasn >= 1B= $inasn <= 65535
ABresult
0X0
100
111
106 7 $self->{_informat} = 'asplain16';
107 7 $self->{_asplain16} = $inasn;
108 }
109 ▶ elsif ($inasn >= AS32_START && $inasn <= AS32_END) {
Condition33%1/3
$inasn >= 65536 and $inasn <= 4294967295
!ll&&!rl&&r
007
MC/DC0%0/2
$inasn >= 65536 and $inasn <= 4294967295
$inasn >= 65536 $inasn <= 4294967295
Truth table33%1/3
A and B
A= $inasn >= 65536B= $inasn <= 4294967295
ABresult
0X0
100
111
110 7 $self->{_informat} = 'asplain32';
111 7 $self->{_asplain32} = $inasn;
112 }
113 else {
114 0 croak __PACKAGE__, ": Invalid ASPLAIN ASN (must be between 1-4294967295)";
115 }
116 }
117 elsif ($inasn=~m/^(\d+)\.(\d+)$/) { #ASN is ASN32 ASDOT+ notation or ASDOT if forced
118  
119 12 my $firstasn = $1;
120 12 my $secondasn = $2;
121  
122 12 ▶ unless (
Branch: 1 branch
BranchTrueFalseTotal
unless ($firstasn >= 0 and $firstasn <= 65535 and ($secondasn >= 0 and $secondasn <= 65535) and $firstasn > 0 || $secondasn > 0) 0 12 12
Condition40%6/15
$firstasn >= 0 and $firstasn <= 65535 and ($secondasn >= 0 and $secondasn <= 65535) and $firstasn > 0 || $secondasn > 0
!ll&&!rl&&r
0012
$firstasn >= 0 and $firstasn <= 65535 and ($secondasn >= 0 and $secondasn <= 65535)
!ll&&!rl&&r
0012
$firstasn >= 0 and $firstasn <= 65535
!ll&&!rl&&r
0012
$secondasn >= 0 and $secondasn <= 65535
!ll&&!rl&&r
0012
$firstasn > 0 or $secondasn > 0
l!l&&r!l&&!r
840
MC/DC0%0/6
$firstasn >= 0 and $firstasn <= 65535 and ($secondasn >= 0 and $secondasn <= 65535) and $firstasn > 0 || $secondasn > 0
$firstasn >= 0 $firstasn <= 65535 $secondasn >= 0 $secondasn <= 65535 $firstasn > 0 $secondasn > 0
Truth table28%2/7
A and B and C and D and E or F
A= $firstasn >= 0B= $firstasn <= 65535C= $secondasn >= 0D= $secondasn <= 65535E= $firstasn > 0F= $secondasn > 0
ABCDEFresult
0XXXXX0
10XXXX0
110XXX0
1110XX0
1111000
11111X1
1111011
123 ($firstasn >= 0 && $firstasn <= AS16_END) &&
124 ($secondasn >= 0 && $secondasn <= AS16_END) &&
125 (
126 ($firstasn > 0) ||
127 ($secondasn > 0)
128 )
129 ) {
130 0 croak __PACKAGE__, ": Invalid ASDOT(+) ASN (must be between 0-65535.0-65535 and NOT 0.0)";
131 }
132  
133 #Allow input as ASDOT if $asasdot is populated
134 12 ▶ if ($asasdot) {
Branch: 1 branch
BranchTrueFalseTotal
if ($asasdot) { } 4 8 12
135 4 ▶ if ($firstasn > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($firstasn > 0) { } 4 0 4
136 4 $self->{_informat} = 'asdot';
137 }
138 else {
139 0 croak __PACKAGE__, ": Invalid ASDOT ASN (ASDOT does NOT permit ASDOT+ notation for ASNs 0-65535)";
140 }
141 }
142 else {
143 8 $self->{_informat} = 'asdotplus';
144 }
145 12 $self->{_asdotsedtet1} = $firstasn;
146 12 $self->{_asdotsedtet2} = $secondasn;
147  
148 }
149 else {
150 0 croak __PACKAGE__, ": Invalid ASN (Illegal Format)";
151 }
152  
153 30 return;
154  
155 }
156  
157 8 ▶sub _plaintodot ($) {
Subroutine _plaintodot: called CC=2 SCAR=7.1
158
159 8 my $self = shift;
160 8 my $asplain = shift;
161  
162 8 ▶ unless ($asplain=~m/^(\d+)$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($asplain =~ /^(\d+)$/) { } 8 0 8
163 0 die ("Internal Error: _plaintodot called with invalid plain");
164 }
165 else {
166 8 my $asdot=int($asplain/65536);
167 8 $asdot .= ".";
168 8 $asdot .= ($asplain - ($asdot*65536));
169 8 return $asdot;
170 }
171  
172 }
173  
174 6 ▶sub _dottoplain ($) {
Subroutine _dottoplain: called CC=2 SCAR=7.1
175  
176 6 my $self = shift;
177 6 my $asdot = shift;
178  
179 6 ▶ unless ($asdot=~m/^(\d+)\.(\d+)$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($asdot =~ /^(\d+)\.(\d+)$/) { } 6 0 6
180 0 die("Internal Error: _dottoplain called with invalid dot");
181 }
182 else {
183 6 my $asplain1 = $1;
184 6 my $asplain2 = $2;
185 6 my $asplain = (65536 * $asplain1);
186 6 $asplain+=$asplain2;
187 6 return $asplain;
188 }
189 }
190  
191 ##Produce ASDOT representation of parsed ASN
192 10 ▶sub toasdot () {
Subroutine toasdot: called CC=7 SCAR=19.5
Pod documented
193  
194 10 my $self = shift;
195 10 ▶ if ($self->{_informat} eq 'asdot') { #User wants asdot and we already have it, just return it
Branch: 4 branches
BranchTrueFalseTotal
if ($self->{'_informat'} eq 'asdot') { } 2 8 10
elsif ($self->{'_informat'} eq 'asdotplus') { } 4 4 8
elsif ($self->{'_informat'} eq 'asplain16') { } 2 2 4
elsif ($self->{'_informat'} eq 'asplain32') { } 2 0 2
196 2 ▶ if ($self->{_asdot}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'_asdot'}) { } 1 1 2
197 1 return $self->{_asdot};
198 }
199 else {
200 1 my $value = "$self->{_asdotsedtet1}.$self->{_asdotsedtet2}";
201 1 return ($value);
202 }
203  
204 }
205 elsif ($self->{_informat} eq 'asdotplus') { #User wants asdot and has given us asdotplus, so return asplain if
206 4 ▶ if ($self->{_asdotsedtet1} == 0) { #If first sedtet is 0, return the second only
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'_asdotsedtet1'} == 0) { } 2 2 4
207 2 return ($self->{_asdotsedtet2});
208 }
209 else { #Else, return both
210 2 my $value = "$self->{_asdotsedtet1}.$self->{_asdotsedtet2}";
211 2 return ($value);
212 }
213 }
214 elsif ($self->{_informat} eq 'asplain16') { #User wants asdot and has given us an 16 bit asplain (just return asplain)
215 2 my $value = $self->{_asplain16};
216 2 return ($value);
217 }
218 elsif ($self->{_informat} eq 'asplain32') { #User wants asdot and has given us an 32 bit asplain
219 2 my $value = $self->{_asplain32};
220 2 $value = $self->_plaintodot($value);
221 2 return ($value);
222 }
223 else {
224 0 die ("Internal Error: no acceptable informat defined");
225 }
226  
227 }
228  
229 ##Produce ASDOT+ representation of parsed ASN
230 10 ▶sub toasdotplus () {
Subroutine toasdotplus: called CC=6 SCAR=17.9
Pod documented
231  
232 10 my $self = shift;
233 10 ▶ if ($self->{_informat} eq 'asdot') { #User wants asdotplus and we have asdot
Branch: 4 branches
BranchTrueFalseTotal
if ($self->{'_informat'} eq 'asdot') { } 4 6 10
elsif ($self->{'_informat'} eq 'asdotplus') { } 2 4 6
elsif ($self->{'_informat'} eq 'asplain16') { } 2 2 4
elsif ($self->{'_informat'} eq 'asplain32') { } 2 0 2
234 4 ▶ if ($self->{_asdot}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'_asdot'}) { } 2 2 4
235 2 my $value = $self->_plaintodot($self->{_asdot});
236 2 return ($value);
237 }
238 else {
239 2 my $value = "$self->{_asdotsedtet1}.$self->{_asdotsedtet2}";
240 2 return ($value);
241 }
242 }
243 elsif ($self->{_informat} eq 'asdotplus') { #User wants asdotplus and we have it, just return it
244 2 my $value = "$self->{_asdotsedtet1}.$self->{_asdotsedtet2}";
245 2 return ($value);
246 }
247 elsif ($self->{_informat} eq 'asplain16') { #User wants asdotplus and has given us an 16 bit asplain
248 2 my $value = $self->{_asplain16};
249 2 $value = $self->_plaintodot($value);
250 2 return ($value);
251 }
252 elsif ($self->{_informat} eq 'asplain32') { #User wants asdotplus and has given us an 32 bit asplain
253 2 my $value = $self->{_asplain32};
254 2 $value = $self->_plaintodot($value);
255 2 return ($value);
256 }
257 else {
258 0 die ("Internal Error: no acceptable informat defined");
259 }
260  
261 }
262  
263 ##Produce ASPLAIN representation of parsed ASN (32 bit version)
264 18 ▶sub toasplain () {
Subroutine toasplain: called CC=6 SCAR=17.9
Pod documented
265  
266 18 my $self = shift;
267  
268 18 ▶ if ($self->{_informat} eq 'asdot') { #User wants asplain and we have asdot
Branch: 4 branches
BranchTrueFalseTotal
if ($self->{'_informat'} eq 'asdot') { } 4 14 18
elsif ($self->{'_informat'} eq 'asplain16') { } 5 9 14
elsif ($self->{'_informat'} eq 'asplain32') { } 5 4 9
elsif ($self->{'_informat'} eq 'asdotplus') { } 4 0 4
269 4 ▶ if ($self->{_asdot}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'_asdot'}) { } 2 2 4
270 2 return ($self->{_asdot});
271 }
272 else {
273 2 my $value = "$self->{_asdotsedtet1}.$self->{_asdotsedtet2}";
274 2 $value = $self->_dottoplain($value);
275 2 return ($value);
276 }
277 }
278 elsif ($self->{_informat} eq 'asplain16') { #User wants asplain and we have it
279 5 my $value = $self->{_asplain16};
280 5 return ($value);
281 }
282 elsif ($self->{_informat} eq 'asplain32') { #User wants asplain and we have it
283 5 my $value = $self->{_asplain32};
284 5 return ($value);
285 }
286 elsif ($self->{_informat} eq 'asdotplus') { #User wants asplain and has given us asdotplus so return asplain
287 4 my $value = "$self->{_asdotsedtet1}.$self->{_asdotsedtet2}";
288 4 $value = $self->_dottoplain($value);
289 4 return ($value);
290 }
291 else {
292 0 die ("Internal Error: no acceptable informat defined");
293 }
294 }
295  
296 ##Produce ASPLAIN representation of parsed ASN (16 bit version)
297 8 ▶sub toasplain16 () {
Subroutine toasplain16: called CC=7 SCAR=20.1
Pod documented
298  
299 8 my $self = shift;
300  
301 8 ▶ if ($self->{_informat} eq 'asdot') { #User wants asplain16 and we have asdot
Branch: 4 branches
BranchTrueFalseTotal
if ($self->{'_informat'} eq 'asdot') { } 3 5 8
elsif ($self->{'_informat'} eq 'asplain16') { } 0 5 5
elsif ($self->{'_informat'} eq 'asplain32') { } 1 4 5
elsif ($self->{'_informat'} eq 'asdotplus') { } 4 0 4
302 3 ▶ if ($self->{_asdot}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'_asdot'}) { } 1 2 3
303 1 return ($self->{_asdot});
304 }
305 else {
306 2 return (AS_TRANS);
307 }
308 }
309 elsif ($self->{_informat} eq 'asplain16') { #User wants asplain and we have it
310 0 my $value = $self->{_asplain16};
311 0 return ($value);
312 }
313 elsif ($self->{_informat} eq 'asplain32') { #User wants asplain so return AS_TRANS
314 1 return (AS_TRANS);
315 }
316 elsif ($self->{_informat} eq 'asdotplus') { #User wants asplain and has given us asdotplus, return AS_TRANS for 32 bit
317 4 ▶ if ($self->{_asdotsedtet1} == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'_asdotsedtet1'} == 0) { } 2 2 4
318 2 return ($self->{_asdotsedtet2});
319 }
320 else {
321 2 return (AS_TRANS);
322 }
323 }
324 else {
325 0 die ("Internal Error: no acceptable informat defined");
326 }
327 }
328  
329 ##Return parsed type
330 6 ▶sub gettype () {
Subroutine gettype: called CC=1 SCAR=0.0
Pod documented
331 6 my $self = shift;
332 6 my $informat = $self->{_informat};
333 6 $informat=~s/\d+//g; #Remove ASPLAIN differentiation
334 6 return ($informat);
335 }
336  
337 ##RFC 6996 reserves some ASN's for private use
338 8 ▶sub isprivate {
Subroutine isprivate: called CC=5 SCAR=16.1
Pod documented
339 8 my $self = shift;
340 8 my $asn = $self->toasplain;
341 8 ▶ if ( ( $asn >= AS16_PRIVATE_START && $asn <= AS16_PRIVATE_END ) ||
Branch: 1 branch
BranchTrueFalseTotal
if ($asn >= 64512 and $asn <= 65534 or $asn >= 4200000000 and $asn <= 4294967294) 4 4 8
Condition88%8/9
$asn >= 64512 and $asn <= 65534 or $asn >= 4200000000 and $asn <= 4294967294
l!l&&r!l&&!r
224
$asn >= 64512 and $asn <= 65534
!ll&&!rl&&r
242
$asn >= 4200000000 and $asn <= 4294967294
!ll&&!rl&&r
402
MC/DC75%3/4
$asn >= 64512 and $asn <= 65534 or $asn >= 4200000000 and $asn <= 4294967294
$asn >= 64512 $asn <= 65534 $asn >= 4200000000 $asn <= 4294967294
Truth table57%4/7
A and B or C and D
A= $asn >= 64512B= $asn <= 65534C= $asn >= 4200000000D= $asn <= 4294967294
ABCDresult
11XX1
0X111
10111
0X0X0
0X100
100X0
10100
342 ( $asn >= AS32_PRIVATE_START && $asn <= AS32_PRIVATE_END ) ) {
343 4 return 1;
344 }
345 4 return 0;
346 }
347  
348 ###NON OO Function wrappers
349 ##toasdot
350 2 ▶sub plaintodot ($) {
Subroutine plaintodot: called CC=4 SCAR=14.6
Pod documented
351 2 my $inasn = shift;
352 2 ▶ croak __PACKAGE__, ": No ASN specified" unless ($inasn);
Branch: 1 branch
BranchTrueFalseTotal
unless $inasn 0 2 2
353 2 ▶ croak __PACKAGE__, ": Must provide ASPLAIN" unless ($inasn=~m/^(\d+)$/); #Ensure only numerical is passed
Branch: 1 branch
BranchTrueFalseTotal
unless $inasn =~ /^(\d+)$/ 0 2 2
354 2 ▶ my $asn = Net::ASN->new($inasn) || croak __PACKAGE__, ": Could not create new Net::ASN object";
Condition50%1/2
'Net::ASN'->new($inasn) || croak(__PACKAGE__, ': Could not create new Net::ASN object')
l!l
20
MC/DC0%0/1
'Net::ASN'->new($inasn) || croak(__PACKAGE__, ': Could not create new Net::ASN object')
'Net::ASN'->new($inasn)
Truth table50%1/2
A
A= 'Net::ASN'->new($inasn)
Aresult
11
00
355 2 return ($asn->toasdot);
356 }
357 ##toasdotplus
358 2 ▶sub plaintodotplus ($) {
Subroutine plaintodotplus: called CC=4 SCAR=14.6
Pod documented
359 2 my $inasn = shift;
360 2 ▶ croak __PACKAGE__, ": No ASN specified" unless ($inasn);
Branch: 1 branch
BranchTrueFalseTotal
unless $inasn 0 2 2
361 2 ▶ croak __PACKAGE__, ": Must provide ASPLAIN" unless ($inasn=~m/^(\d+)$/); #Ensure only numerical is passed
Branch: 1 branch
BranchTrueFalseTotal
unless $inasn =~ /^(\d+)$/ 0 2 2
362 2 ▶ my $asn = Net::ASN->new($inasn) || croak __PACKAGE__, ": Could not create new Net::ASN object";
Condition50%1/2
'Net::ASN'->new($inasn) || croak(__PACKAGE__, ': Could not create new Net::ASN object')
l!l
20
MC/DC0%0/1
'Net::ASN'->new($inasn) || croak(__PACKAGE__, ': Could not create new Net::ASN object')
'Net::ASN'->new($inasn)
Truth table50%1/2
A
A= 'Net::ASN'->new($inasn)
Aresult
11
00
363 2 return ($asn->toasdotplus);
364 }
365 ##toasdotplus
366 2 ▶sub dottodotplus ($) {
Subroutine dottodotplus: called CC=3 SCAR=11.4
Pod documented
367 2 my $inasn = shift;
368 2 ▶ croak __PACKAGE__, ": No ASN specified" unless ($inasn);
Branch: 1 branch
BranchTrueFalseTotal
unless $inasn 0 2 2
369 2 ▶ my $asn = Net::ASN->new($inasn,1) || croak __PACKAGE__, ": Could not create new Net::ASN object";
Condition50%1/2
'Net::ASN'->new($inasn, 1) || croak(__PACKAGE__, ': Could not create new Net::ASN object')
l!l
20
MC/DC0%0/1
'Net::ASN'->new($inasn, 1) || croak(__PACKAGE__, ': Could not create new Net::ASN object')
'Net::ASN'->new($inasn, 1)
Truth table50%1/2
A
A= 'Net::ASN'->new($inasn, 1)
Aresult
11
00
370 2 return ($asn->toasdotplus);
371 }
372 ##toasplain
373 2 ▶sub dottoplain ($) {
Subroutine dottoplain: called CC=3 SCAR=11.4
Pod documented
374 2 my $inasn = shift;
375 2 ▶ croak __PACKAGE__, ": No ASN specified" unless ($inasn);
Branch: 1 branch
BranchTrueFalseTotal
unless $inasn 0 2 2
376 2 ▶ my $asn = Net::ASN->new($inasn,1) || croak __PACKAGE__, ": Could not create new Net::ASN object";
Condition50%1/2
'Net::ASN'->new($inasn, 1) || croak(__PACKAGE__, ': Could not create new Net::ASN object')
l!l
20
MC/DC0%0/1
'Net::ASN'->new($inasn, 1) || croak(__PACKAGE__, ': Could not create new Net::ASN object')
'Net::ASN'->new($inasn, 1)
Truth table50%1/2
A
A= 'Net::ASN'->new($inasn, 1)
Aresult
11
00
377 2 return ($asn->toasplain);
378 }
379 ##toasplain16
380 2 ▶sub dottoplain16 ($) {
Subroutine dottoplain16: called CC=3 SCAR=11.4
Pod documented
381 2 my $inasn = shift;
382 2 ▶ croak __PACKAGE__, ": No ASN specified" unless ($inasn);
Branch: 1 branch
BranchTrueFalseTotal
unless $inasn 0 2 2
383 2 ▶ my $asn = Net::ASN->new($inasn,1) || croak __PACKAGE__, ": Could not create new Net::ASN object";
Condition50%1/2
'Net::ASN'->new($inasn, 1) || croak(__PACKAGE__, ': Could not create new Net::ASN object')
l!l
20
MC/DC0%0/1
'Net::ASN'->new($inasn, 1) || croak(__PACKAGE__, ': Could not create new Net::ASN object')
'Net::ASN'->new($inasn, 1)
Truth table50%1/2
A
A= 'Net::ASN'->new($inasn, 1)
Aresult
11
00
384 2 return ($asn->toasplain16);
385 }
386 ##toasdot again
387 2 ▶sub dotplustodot ($) {
Subroutine dotplustodot: called CC=4 SCAR=14.6
Pod documented
388 2 my $inasn = shift;
389 2 ▶ croak __PACKAGE__, ": No ASN specified" unless ($inasn);
Branch: 1 branch
BranchTrueFalseTotal
unless $inasn 0 2 2
390 2 ▶ croak __PACKAGE__, ": Must provide ASDOT+" unless ($inasn=~m/\./); #Ensure only dotted is passed
Branch: 1 branch
BranchTrueFalseTotal
unless $inasn =~ /\./ 0 2 2
391 2 ▶ my $asn = Net::ASN->new($inasn) || croak __PACKAGE__, ": Could not create new Net::ASN object";
Condition50%1/2
'Net::ASN'->new($inasn) || croak(__PACKAGE__, ': Could not create new Net::ASN object')
l!l
20
MC/DC0%0/1
'Net::ASN'->new($inasn) || croak(__PACKAGE__, ': Could not create new Net::ASN object')
'Net::ASN'->new($inasn)
Truth table50%1/2
A
A= 'Net::ASN'->new($inasn)
Aresult
11
00
392 2 return ($asn->toasdot);
393 }
394 ##toasplain
395 2 ▶sub dotplustoplain ($) {
Subroutine dotplustoplain: called CC=4 SCAR=14.6
Pod documented
396 2 my $inasn = shift;
397 2 ▶ croak __PACKAGE__, ": No ASN specified" unless ($inasn);
Branch: 1 branch
BranchTrueFalseTotal
unless $inasn 0 2 2
398 2 ▶ croak __PACKAGE__, ": Must provide ASDOT+" unless ($inasn=~m/\./); #Ensure only dotted is passed
Branch: 1 branch
BranchTrueFalseTotal
unless $inasn =~ /\./ 0 2 2
399 2 ▶ my $asn = Net::ASN->new($inasn) || croak __PACKAGE__, ": Could not create new Net::ASN object";
Condition50%1/2
'Net::ASN'->new($inasn) || croak(__PACKAGE__, ': Could not create new Net::ASN object')
l!l
20
MC/DC0%0/1
'Net::ASN'->new($inasn) || croak(__PACKAGE__, ': Could not create new Net::ASN object')
'Net::ASN'->new($inasn)
Truth table50%1/2
A
A= 'Net::ASN'->new($inasn)
Aresult
11
00
400 2 return ($asn->toasplain);
401 }
402 ##toasplain16
403 2 ▶sub dotplustoplain16 ($) {
Subroutine dotplustoplain16: called CC=4 SCAR=14.6
Pod documented
404 2 my $inasn = shift;
405 2 ▶ croak __PACKAGE__, ": No ASN specified" unless ($inasn);
Branch: 1 branch
BranchTrueFalseTotal
unless $inasn 0 2 2
406 2 ▶ croak __PACKAGE__, ": Must provide ASDOT+" unless ($inasn=~m/\./); #Ensure only dotted is passed
Branch: 1 branch
BranchTrueFalseTotal
unless $inasn =~ /\./ 0 2 2
407 2 ▶ my $asn = Net::ASN->new($inasn) || croak __PACKAGE__, ": Could not create new Net::ASN object";
Condition50%1/2
'Net::ASN'->new($inasn) || croak(__PACKAGE__, ': Could not create new Net::ASN object')
l!l
20
MC/DC0%0/1
'Net::ASN'->new($inasn) || croak(__PACKAGE__, ': Could not create new Net::ASN object')
'Net::ASN'->new($inasn)
Truth table50%1/2
A
A= 'Net::ASN'->new($inasn)
Aresult
11
00
408 2 return ($asn->toasplain16);
409 }
410  
411 ##isprivate
412 4 ▶sub isprivateasn ($) {
Subroutine isprivateasn: called CC=3 SCAR=11.4
Pod documented
413 4 my $inasn = shift;
414 4 ▶ croak __PACKAGE__, ": No ASN specified" unless ($inasn);
Branch: 1 branch
BranchTrueFalseTotal
unless $inasn 0 4 4
415 4 ▶ my $asn = Net::ASN->new($inasn) || croak __PACKAGE__, ": Could not create new Net::ASN object";
Condition50%1/2
'Net::ASN'->new($inasn) || croak(__PACKAGE__, ': Could not create new Net::ASN object')
l!l
40
MC/DC0%0/1
'Net::ASN'->new($inasn) || croak(__PACKAGE__, ': Could not create new Net::ASN object')
'Net::ASN'->new($inasn)
Truth table50%1/2
A
A= 'Net::ASN'->new($inasn)
Aresult
11
00
416 4 return ($asn->isprivate);
417 }
418  
419 1 1;
420 __END__
↑ Summary