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 SCAR 13.9
CC
4
Cov
87%
merge
3.0
length
2.0
asstring
2.0
CRAP 4.0
« BGP/Refresh.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.16';
11  
12 sub type {
13 7 ▶ return 1;
Subroutine type: called CC=1 SCAR=0.0
Pod undocumented
14 }
15  
16 sub length {
17 43 ▶ my $this = shift;
Subroutine length: called CC=2 SCAR=6.9
Pod undocumented
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 43 ▶ if (scalar(keys %$this)) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar keys %$this) { } 41 2 43
24 41 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 sub as_string {
33 262 ▶ my $this = shift;
Subroutine as_string: called CC=1 SCAR=0.0
Pod undocumented
34 262 return '{' . join(',', sort { $a <=> $b } keys %{$this}) . '}';
35 }
36  
37 sub asarray {
38 24 ▶ my $this = shift;
Subroutine asarray: called CC=1 SCAR=0.0
Pod undocumented
39 24 return [ sort { $a <=> $b } keys %{$this} ];
40 }
41  
42 sub merge {
43 24 ▶ my $this = shift;
Subroutine merge: called CC=3 SCAR=11.0
Pod undocumented
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 sub count {
53 0 ▶ my $this = shift;
Subroutine count: not called CC=1 SCAR=6.9
Pod undocumented
54  
55 0 return scalar(@{$this});
56 }
57  
58 7 1;
59  
« BGP/Refresh.pm ↑ Summary BGP/ASPath/AS_SEQUENCE.pm »