blib/lib/Net/ASN.pm

filter: Statementstmt 91.4% 160 / 175 Branchbran 71.8% 69 / 96 Conditioncond 39.5% 19 / 48 MC/DCmcdc 3.5% 1 / 28 Subroutinesub 100% 22 / 22 Podpod 100% 14 / 14 totaltotal 74.4% 285 / 383 CC 65 SCAR 25.1
CC
65
Cov
78%
_parseasn
37.2
toasplain16
7.4
toasdot
7.0
CRAP 12.3
↑ 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 BEGIN {
17  
18 1 ▶ require Exporter;
Subroutine BEGIN: called CC=1 SCAR=0.0
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 } ],
31 );
32  
33 1 @EXPORT_OK = qw();
34  
35 1 Exporter::export_ok_tags('all');
36  
37 1 $VERSION = '1.06';
38 }
39  
40 # Preloaded methods go here.
41 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
42  
43 #Constants
44 1 ▶use constant AS_TRANS => 23456;
Subroutine BEGIN: called CC=1 SCAR=0.0
45  
46 ##OO Methods
47  
48 #Initialise with an ASN
49 #
50 sub new {
51  
52 22 ▶ my $class = shift;
Subroutine new: called CC=1 SCAR=0.0
Pod documented
53 22 my $self = {};
54  
55 22 my $asn = shift;
56  
57 22 my $asasdot = shift;
58  
59 22 bless $self, $class;
60  
61 22 $self->_parseasn($asn,$asasdot); #Parse the ASN
62  
63 22 return $self;
64  
65 }
66  
67 #Parses an ASN, in any format
68 sub _parseasn ($;$) {
69  
70 22 ▶ my $self = shift;
Subroutine _parseasn: called CC=20 SCAR=36.2
71 22 my $inasn = shift;
72 22 my $asasdot = shift;
73  
74 #Perform some basic checks
75 #
76 #1) did we even get a parameter?
77 22 ▶ unless ($inasn) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($inasn) 0 22 22
78 0 croak __PACKAGE__, ": ASN not provided";
79 }
80 #2) does the ASN contain a valid character set?
81 22 ▶ unless ($inasn=~m/^[\d\.]+$/) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($inasn =~ /^[\d\.]+$/) 0 22 22
82 0 croak __PACKAGE__, ": Invalid ASN (Illegal Characters)";
83 }
84 #3) Next, check the format
85  
86 22 ▶ 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+)$/) { } 10 12 22
elsif ($inasn =~ /^(\d+)\.(\d+)$/) { } 12 0 12
87 10 ▶ if ($asasdot) {
Branch: 3 branches
BranchTrueFalseTotal
if ($asasdot) { } 4 6 10
elsif ($inasn > 0 and $inasn <= 65535) { } 3 3 6
elsif ($inasn > 65535 and $inasn <= 4294967295) { } 3 0 3
88 4 ▶ if ($inasn > 0 && $inasn <= 65535) {
Branch: 1 branch
BranchTrueFalseTotal
if ($inasn > 0 and $inasn <= 65535) { } 4 0 4
Condition33%1/3
$inasn > 0 and $inasn <= 65535
!ll&&!rl&&r
004
MC/DC0%0/2
$inasn > 0 and $inasn <= 65535
$inasn > 0 $inasn <= 65535
Truth table33%1/3
A and B
A= $inasn > 0B= $inasn <= 65535
ABresult
0X0
100
111
89 4 $self->{_informat} = 'asdot';
90 4 $self->{_asdot} = $inasn;
91 }
92 else {
93 0 croak __PACKAGE__, ": Invalid ASDOT ASN (ASDOT does NOT permit ASPLAIN notation for ASNs 63356-4294967295)";
94 }
95 }
96 ▶ elsif ($inasn > 0 && $inasn <= 65535) {
Condition66%2/3
$inasn > 0 and $inasn <= 65535
!ll&&!rl&&r
033
MC/DC50%1/2
$inasn > 0 and $inasn <= 65535
$inasn > 0 $inasn <= 65535
Truth table66%2/3
A and B
A= $inasn > 0B= $inasn <= 65535
ABresult
0X0
100
111
97 3 $self->{_informat} = 'asplain16';
98 3 $self->{_asplain16} = $inasn;
99 }
100 ▶ elsif ($inasn > 65535 && $inasn <= 4294967295) {
Condition33%1/3
$inasn > 65535 and $inasn <= 4294967295
!ll&&!rl&&r
003
MC/DC0%0/2
$inasn > 65535 and $inasn <= 4294967295
$inasn > 65535 $inasn <= 4294967295
Truth table33%1/3
A and B
A= $inasn > 65535B= $inasn <= 4294967295
ABresult
0X0
100
111
101 3 $self->{_informat} = 'asplain32';
102 3 $self->{_asplain32} = $inasn;
103 }
104 else {
105 0 croak __PACKAGE__, ": Invalid ASPLAIN ASN (must be between 1-4294967295)";
106 }
107 }
108 elsif ($inasn=~m/^(\d+)\.(\d+)$/) { #ASN is ASN32 ASDOT+ notation or ASDOT if forced
109  
110 12 my $firstasn = $1;
111 12 my $secondasn = $2;
112  
113 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
Condition46%7/15
$firstasn >= 0 and $firstasn <= 65535 and ($secondasn >= 0 and $secondasn <= 65535) and $firstasn > 0 || $secondasn > 0
!ll&&!rl&&r
048
$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 table14%1/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
114 ($firstasn >= 0 && $firstasn <= 65535) &&
115 ($secondasn >= 0 && $secondasn <= 65535) &&
116 (
117 ($firstasn > 0) ||
118 ($secondasn > 0)
119 )
120 ) {
121 0 croak __PACKAGE__, ": Invalid ASDOT(+) ASN (must be between 0-65535.0-65535 and NOT 0.0)";
122 }
123  
124 #Allow input as ASDOT if $asasdot is populated
125 12 ▶ if ($asasdot) {
Branch: 1 branch
BranchTrueFalseTotal
if ($asasdot) { } 4 8 12
126 4 ▶ if ($firstasn > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($firstasn > 0) { } 4 0 4
127 4 $self->{_informat} = 'asdot';
128 }
129 else {
130 0 croak __PACKAGE__, ": Invalid ASDOT ASN (ASDOT does NOT permit ASDOT+ notation for ASNs 0-65535)";
131 }
132 }
133 else {
134 8 $self->{_informat} = 'asdotplus';
135 }
136 12 $self->{_asdotsedtet1} = $firstasn;
137 12 $self->{_asdotsedtet2} = $secondasn;
138  
139 }
140 else {
141 0 croak __PACKAGE__, ": Invalid ASN (Illegal Format)";
142 }
143  
144 22 return;
145  
146 }
147  
148 sub _plaintodot ($) {
149
150 8 ▶ my $self = shift;
Subroutine _plaintodot: called CC=2 SCAR=7.1
151 8 my $asplain = shift;
152  
153 8 ▶ unless ($asplain=~m/^(\d+)$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($asplain =~ /^(\d+)$/) { } 8 0 8
154 0 die ("Internal Error: _plaintodot called with invalid plain");
155 }
156 else {
157 8 my $asdot=int($asplain/65536);
158 8 $asdot .= ".";
159 8 $asdot .= ($asplain - ($asdot*65536));
160 8 return $asdot;
161 }
162  
163 }
164  
165 sub _dottoplain ($) {
166  
167 6 ▶ my $self = shift;
Subroutine _dottoplain: called CC=2 SCAR=7.1
168 6 my $asdot = shift;
169  
170 6 ▶ unless ($asdot=~m/^(\d+)\.(\d+)$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($asdot =~ /^(\d+)\.(\d+)$/) { } 6 0 6
171 0 die("Internal Error: _dottoplain called with invalid dot");
172 }
173 else {
174 6 my $asplain1 = $1;
175 6 my $asplain2 = $2;
176 6 my $asplain = (65536 * $asplain1);
177 6 $asplain+=$asplain2;
178 6 return $asplain;
179 }
180 }
181  
182 ##Produce ASDOT representation of parsed ASN
183 sub toasdot () {
184  
185 10 ▶ my $self = shift;
Subroutine toasdot: called CC=7 SCAR=19.5
Pod documented
186 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
187 2 ▶ if ($self->{_asdot}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'_asdot'}) { } 1 1 2
188 1 return $self->{_asdot};
189 }
190 else {
191 1 my $value = "$self->{_asdotsedtet1}.$self->{_asdotsedtet2}";
192 1 return ($value);
193 }
194  
195 }
196 elsif ($self->{_informat} eq 'asdotplus') { #User wants asdot and has given us asdotplus, so return asplain if
197 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
198 2 return ($self->{_asdotsedtet2});
199 }
200 else { #Else, return both
201 2 my $value = "$self->{_asdotsedtet1}.$self->{_asdotsedtet2}";
202 2 return ($value);
203 }
204 }
205 elsif ($self->{_informat} eq 'asplain16') { #User wants asdot and has given us an 16 bit asplain (just return asplain)
206 2 my $value = $self->{_asplain16};
207 2 return ($value);
208 }
209 elsif ($self->{_informat} eq 'asplain32') { #User wants asdot and has given us an 32 bit asplain
210 2 my $value = $self->{_asplain32};
211 2 $value = $self->_plaintodot($value);
212 2 return ($value);
213 }
214 else {
215 0 die ("Internal Error: no acceptable informat defined");
216 }
217  
218 }
219  
220 ##Produce ASDOT+ representation of parsed ASN
221 sub toasdotplus () {
222  
223 10 ▶ my $self = shift;
Subroutine toasdotplus: called CC=6 SCAR=17.9
Pod documented
224 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
225 4 ▶ if ($self->{_asdot}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'_asdot'}) { } 2 2 4
226 2 my $value = $self->_plaintodot($self->{_asdot});
227 2 return ($value);
228 }
229 else {
230 2 my $value = "$self->{_asdotsedtet1}.$self->{_asdotsedtet2}";
231 2 return ($value);
232 }
233 }
234 elsif ($self->{_informat} eq 'asdotplus') { #User wants asdotplus and we have it, just return it
235 2 my $value = "$self->{_asdotsedtet1}.$self->{_asdotsedtet2}";
236 2 return ($value);
237 }
238 elsif ($self->{_informat} eq 'asplain16') { #User wants asdotplus and has given us an 16 bit asplain
239 2 my $value = $self->{_asplain16};
240 2 $value = $self->_plaintodot($value);
241 2 return ($value);
242 }
243 elsif ($self->{_informat} eq 'asplain32') { #User wants asdotplus and has given us an 32 bit asplain
244 2 my $value = $self->{_asplain32};
245 2 $value = $self->_plaintodot($value);
246 2 return ($value);
247 }
248 else {
249 0 die ("Internal Error: no acceptable informat defined");
250 }
251  
252 }
253  
254 ##Produce ASPLAIN representation of parsed ASN (32 bit version)
255 sub toasplain () {
256  
257 10 ▶ my $self = shift;
Subroutine toasplain: called CC=6 SCAR=17.9
Pod documented
258  
259 10 ▶ if ($self->{_informat} eq 'asdot') { #User wants asplain and we have asdot
Branch: 4 branches
BranchTrueFalseTotal
if ($self->{'_informat'} eq 'asdot') { } 4 6 10
elsif ($self->{'_informat'} eq 'asplain16') { } 1 5 6
elsif ($self->{'_informat'} eq 'asplain32') { } 1 4 5
elsif ($self->{'_informat'} eq 'asdotplus') { } 4 0 4
260 4 ▶ if ($self->{_asdot}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'_asdot'}) { } 2 2 4
261 2 return ($self->{_asdot});
262 }
263 else {
264 2 my $value = "$self->{_asdotsedtet1}.$self->{_asdotsedtet2}";
265 2 $value = $self->_dottoplain($value);
266 2 return ($value);
267 }
268 }
269 elsif ($self->{_informat} eq 'asplain16') { #User wants asplain and we have it
270 1 my $value = $self->{_asplain16};
271 1 return ($value);
272 }
273 elsif ($self->{_informat} eq 'asplain32') { #User wants asplain and we have it
274 1 my $value = $self->{_asplain32};
275 1 return ($value);
276 }
277 elsif ($self->{_informat} eq 'asdotplus') { #User wants asplain and has given us asdotplus so return asplain
278 4 my $value = "$self->{_asdotsedtet1}.$self->{_asdotsedtet2}";
279 4 $value = $self->_dottoplain($value);
280 4 return ($value);
281 }
282 else {
283 0 die ("Internal Error: no acceptable informat defined");
284 }
285 }
286  
287 ##Produce ASPLAIN representation of parsed ASN (16 bit version)
288 sub toasplain16 () {
289  
290 8 ▶ my $self = shift;
Subroutine toasplain16: called CC=7 SCAR=20.1
Pod documented
291  
292 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
293 3 ▶ if ($self->{_asdot}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'_asdot'}) { } 1 2 3
294 1 return ($self->{_asdot});
295 }
296 else {
297 2 return (AS_TRANS);
298 }
299 }
300 elsif ($self->{_informat} eq 'asplain16') { #User wants asplain and we have it
301 0 my $value = $self->{_asplain16};
302 0 return ($value);
303 }
304 elsif ($self->{_informat} eq 'asplain32') { #User wants asplain so return AS_TRANS
305 1 return (AS_TRANS);
306 }
307 elsif ($self->{_informat} eq 'asdotplus') { #User wants asplain and has given us asdotplus, return AS_TRANS for 32 bit
308 4 ▶ if ($self->{_asdotsedtet1} == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'_asdotsedtet1'} == 0) { } 2 2 4
309 2 return ($self->{_asdotsedtet2});
310 }
311 else {
312 2 return (AS_TRANS);
313 }
314 }
315 else {
316 0 die ("Internal Error: no acceptable informat defined");
317 }
318 }
319  
320 ##Return parsed type
321 sub gettype () {
322 6 ▶ my $self = shift;
Subroutine gettype: called CC=1 SCAR=0.0
Pod documented
323 6 my $informat = $self->{_informat};
324 6 $informat=~s/\d+//g; #Remove ASPLAIN differentiation
325 6 return ($informat);
326 }
327  
328 ###NON OO Function wrappers
329 ##toasdot
330 sub plaintodot ($) {
331 2 ▶ my $inasn = shift;
Subroutine plaintodot: called CC=4 SCAR=15.2
Pod documented
332 2 ▶ croak __PACKAGE__, ": No ASN specified" unless ($inasn);
Branch: 1 branch
BranchTrueFalseTotal
unless $inasn 0 2 2
333 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
334 2 ▶ my $asn = Net::ASN->new($inasn) || croak __PACKAGE__, ": Could not create new Net::ASN object";
Condition33%1/3
'Net::ASN'->new($inasn) || croak(__PACKAGE__, ': Could not create new Net::ASN object')
l!l&&r!l&&!r
200
MC/DC0%0/2
'Net::ASN'->new($inasn) || croak(__PACKAGE__, ': Could not create new Net::ASN object')
'Net::ASN'->new($inasn) croak(__PACKAGE__, ': Could not create new Net::ASN object')
Truth table33%1/3
A || B
A= 'Net::ASN'->new($inasn)B= croak(__PACKAGE__, ': Could not create new Net::ASN object')
ABresult
1X1
011
000
335 2 return ($asn->toasdot);
336 }
337 ##toasdotplus
338 sub plaintodotplus ($) {
339 2 ▶ my $inasn = shift;
Subroutine plaintodotplus: called CC=4 SCAR=15.2
Pod documented
340 2 ▶ croak __PACKAGE__, ": No ASN specified" unless ($inasn);
Branch: 1 branch
BranchTrueFalseTotal
unless $inasn 0 2 2
341 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
342 2 ▶ my $asn = Net::ASN->new($inasn) || croak __PACKAGE__, ": Could not create new Net::ASN object";
Condition33%1/3
'Net::ASN'->new($inasn) || croak(__PACKAGE__, ': Could not create new Net::ASN object')
l!l&&r!l&&!r
200
MC/DC0%0/2
'Net::ASN'->new($inasn) || croak(__PACKAGE__, ': Could not create new Net::ASN object')
'Net::ASN'->new($inasn) croak(__PACKAGE__, ': Could not create new Net::ASN object')
Truth table33%1/3
A || B
A= 'Net::ASN'->new($inasn)B= croak(__PACKAGE__, ': Could not create new Net::ASN object')
ABresult
1X1
011
000
343 2 return ($asn->toasdotplus);
344 }
345 ##toasdotplus
346 sub dottodotplus ($) {
347 2 ▶ my $inasn = shift;
Subroutine dottodotplus: called CC=3 SCAR=12.0
Pod documented
348 2 ▶ croak __PACKAGE__, ": No ASN specified" unless ($inasn);
Branch: 1 branch
BranchTrueFalseTotal
unless $inasn 0 2 2
349 2 ▶ my $asn = Net::ASN->new($inasn,1) || croak __PACKAGE__, ": Could not create new Net::ASN object";
Condition33%1/3
'Net::ASN'->new($inasn, 1) || croak(__PACKAGE__, ': Could not create new Net::ASN object')
l!l&&r!l&&!r
200
MC/DC0%0/2
'Net::ASN'->new($inasn, 1) || croak(__PACKAGE__, ': Could not create new Net::ASN object')
'Net::ASN'->new($inasn, 1) croak(__PACKAGE__, ': Could not create new Net::ASN object')
Truth table33%1/3
A || B
A= 'Net::ASN'->new($inasn, 1)B= croak(__PACKAGE__, ': Could not create new Net::ASN object')
ABresult
1X1
011
000
350 2 return ($asn->toasdotplus);
351 }
352 ##toasplain
353 sub dottoplain ($) {
354 2 ▶ my $inasn = shift;
Subroutine dottoplain: called CC=3 SCAR=12.0
Pod documented
355 2 ▶ croak __PACKAGE__, ": No ASN specified" unless ($inasn);
Branch: 1 branch
BranchTrueFalseTotal
unless $inasn 0 2 2
356 2 ▶ my $asn = Net::ASN->new($inasn,1) || croak __PACKAGE__, ": Could not create new Net::ASN object";
Condition33%1/3
'Net::ASN'->new($inasn, 1) || croak(__PACKAGE__, ': Could not create new Net::ASN object')
l!l&&r!l&&!r
200
MC/DC0%0/2
'Net::ASN'->new($inasn, 1) || croak(__PACKAGE__, ': Could not create new Net::ASN object')
'Net::ASN'->new($inasn, 1) croak(__PACKAGE__, ': Could not create new Net::ASN object')
Truth table33%1/3
A || B
A= 'Net::ASN'->new($inasn, 1)B= croak(__PACKAGE__, ': Could not create new Net::ASN object')
ABresult
1X1
011
000
357 2 return ($asn->toasplain);
358 }
359 ##toasplain16
360 sub dottoplain16 ($) {
361 2 ▶ my $inasn = shift;
Subroutine dottoplain16: called CC=3 SCAR=12.0
Pod documented
362 2 ▶ croak __PACKAGE__, ": No ASN specified" unless ($inasn);
Branch: 1 branch
BranchTrueFalseTotal
unless $inasn 0 2 2
363 2 ▶ my $asn = Net::ASN->new($inasn,1) || croak __PACKAGE__, ": Could not create new Net::ASN object";
Condition33%1/3
'Net::ASN'->new($inasn, 1) || croak(__PACKAGE__, ': Could not create new Net::ASN object')
l!l&&r!l&&!r
200
MC/DC0%0/2
'Net::ASN'->new($inasn, 1) || croak(__PACKAGE__, ': Could not create new Net::ASN object')
'Net::ASN'->new($inasn, 1) croak(__PACKAGE__, ': Could not create new Net::ASN object')
Truth table33%1/3
A || B
A= 'Net::ASN'->new($inasn, 1)B= croak(__PACKAGE__, ': Could not create new Net::ASN object')
ABresult
1X1
011
000
364 2 return ($asn->toasplain16);
365 }
366 ##toasdot again
367 sub dotplustodot ($) {
368 2 ▶ my $inasn = shift;
Subroutine dotplustodot: called CC=4 SCAR=15.2
Pod documented
369 2 ▶ croak __PACKAGE__, ": No ASN specified" unless ($inasn);
Branch: 1 branch
BranchTrueFalseTotal
unless $inasn 0 2 2
370 2 ▶ croak __PACKAGE__, ": Must provide ASDOT+" unless ($inasn=~m/\./); #Ensure only dotted is passed
Branch: 1 branch
BranchTrueFalseTotal
unless $inasn =~ /\./ 0 2 2
371 2 ▶ my $asn = Net::ASN->new($inasn) || croak __PACKAGE__, ": Could not create new Net::ASN object";
Condition33%1/3
'Net::ASN'->new($inasn) || croak(__PACKAGE__, ': Could not create new Net::ASN object')
l!l&&r!l&&!r
200
MC/DC0%0/2
'Net::ASN'->new($inasn) || croak(__PACKAGE__, ': Could not create new Net::ASN object')
'Net::ASN'->new($inasn) croak(__PACKAGE__, ': Could not create new Net::ASN object')
Truth table33%1/3
A || B
A= 'Net::ASN'->new($inasn)B= croak(__PACKAGE__, ': Could not create new Net::ASN object')
ABresult
1X1
011
000
372 2 return ($asn->toasdot);
373 }
374 ##toasplain
375 sub dotplustoplain ($) {
376 2 ▶ my $inasn = shift;
Subroutine dotplustoplain: called CC=4 SCAR=15.2
Pod documented
377 2 ▶ croak __PACKAGE__, ": No ASN specified" unless ($inasn);
Branch: 1 branch
BranchTrueFalseTotal
unless $inasn 0 2 2
378 2 ▶ croak __PACKAGE__, ": Must provide ASDOT+" unless ($inasn=~m/\./); #Ensure only dotted is passed
Branch: 1 branch
BranchTrueFalseTotal
unless $inasn =~ /\./ 0 2 2
379 2 ▶ my $asn = Net::ASN->new($inasn) || croak __PACKAGE__, ": Could not create new Net::ASN object";
Condition33%1/3
'Net::ASN'->new($inasn) || croak(__PACKAGE__, ': Could not create new Net::ASN object')
l!l&&r!l&&!r
200
MC/DC0%0/2
'Net::ASN'->new($inasn) || croak(__PACKAGE__, ': Could not create new Net::ASN object')
'Net::ASN'->new($inasn) croak(__PACKAGE__, ': Could not create new Net::ASN object')
Truth table33%1/3
A || B
A= 'Net::ASN'->new($inasn)B= croak(__PACKAGE__, ': Could not create new Net::ASN object')
ABresult
1X1
011
000
380 2 return ($asn->toasplain);
381 }
382 ##toasplain16
383 sub dotplustoplain16 ($) {
384 2 ▶ my $inasn = shift;
Subroutine dotplustoplain16: called CC=4 SCAR=15.2
Pod documented
385 2 ▶ croak __PACKAGE__, ": No ASN specified" unless ($inasn);
Branch: 1 branch
BranchTrueFalseTotal
unless $inasn 0 2 2
386 2 ▶ croak __PACKAGE__, ": Must provide ASDOT+" unless ($inasn=~m/\./); #Ensure only dotted is passed
Branch: 1 branch
BranchTrueFalseTotal
unless $inasn =~ /\./ 0 2 2
387 2 ▶ my $asn = Net::ASN->new($inasn) || croak __PACKAGE__, ": Could not create new Net::ASN object";
Condition33%1/3
'Net::ASN'->new($inasn) || croak(__PACKAGE__, ': Could not create new Net::ASN object')
l!l&&r!l&&!r
200
MC/DC0%0/2
'Net::ASN'->new($inasn) || croak(__PACKAGE__, ': Could not create new Net::ASN object')
'Net::ASN'->new($inasn) croak(__PACKAGE__, ': Could not create new Net::ASN object')
Truth table33%1/3
A || B
A= 'Net::ASN'->new($inasn)B= croak(__PACKAGE__, ': Could not create new Net::ASN object')
ABresult
1X1
011
000
388 2 return ($asn->toasplain16);
389 }
390  
391 1 1;
392 __END__
↑ Summary