BGP/ASPath/AS_SET.pm

filter: Statementstmt 86.2% 25 / 29 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 75.0% 6 / 8 Podpod 0.0% 0 / 7 totaltotal 71.7% 33 / 46 CC 4 SCAR 6.5
CC
4
Cov
87%
merge
3.0
length
2.0
asstring
2.0
CRAP 1.9
« BGP/Notification.pm ↑ Summary BGP/ASPath/AS_SEQUENCE.pm »
1 #!/usr/bin/perl
2  
3 package Net::BGP::ASPath::AS_SET;
4  
5 7 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 ## Inheritance and Versioning ##
8  
9 7 @Net::BGP::ASPath::AS_SET::ISA = qw( Net::BGP::ASPath::AS );
10 7 our $VERSION = '0.18';
11  
12 7 ▶sub type {
Subroutine type: called CC=1 SCAR=0.0
Pod undocumented
13 7 return 1;
14 }
15  
16 41 ▶sub length {
Subroutine length: called CC=2 SCAR=6.9
Pod undocumented
17 41 my $this = shift;
18  
19 # We really shouldn't see empty ones of these, but if we do,
20 # we will treat them as zero. But otherwise, RFC indicates
21 # that in path computations, any AS_SET is equal to one hop.
22  
23 41 ▶ if (scalar(keys %$this)) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar keys %$this) { } 39 2 41
24 39 return 1;
25 } else {
26 2 return 0;
27 }
28 }
29  
30 0 ▶sub asstring { as_string(@_) }
Subroutine asstring: not called CC=1 SCAR=6.9
Pod undocumented
31  
32 262 ▶sub as_string {
Subroutine as_string: called CC=1 SCAR=0.0
Pod undocumented
33 262 my $this = shift;
34 262 return '{' . join(',', sort { $a <=> $b } keys %{$this}) . '}';
35 }
36  
37 24 ▶sub asarray {
Subroutine asarray: called CC=1 SCAR=0.0
Pod undocumented
38 24 my $this = shift;
39 24 return [ sort { $a <=> $b } keys %{$this} ];
40 }
41  
42 24 ▶sub merge {
Subroutine merge: called CC=3 SCAR=11.0
Pod undocumented
43 24 my $this = shift;
44 24 foreach my $obj (@_) {
45 24 foreach my $as (@{$obj}) {
46 30 $this->{$as} = 1;
47 }
48 }
49 24 return $this;
50 }
51  
52 0 ▶sub count {
Subroutine count: not called CC=1 SCAR=6.9
Pod undocumented
53 0 my $this = shift;
54  
55 0 return scalar(@{$this});
56 }
57  
58 7 1;
59  
« BGP/Notification.pm ↑ Summary BGP/ASPath/AS_SEQUENCE.pm »