Finger/ResultSet.pm

filter: Statementstmt 20.0% 6 / 30 Branchbran 0.0% 0 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 25.0% 1 / 4 Podpod 0.0% 0 / 2 totaltotal 15.2% 7 / 46 CC 9 SCAR 33.3
CC
9
Cov
15%
as_string
42.0
merged_keys
20.0
__ANON__
2.0
CRAP 27.9
« Finger/DNS.pm ↑ Summary Finger/App.pm »
1 package PGP::Finger::ResultSet;
2  
3 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 # ABSTRACT: object to hold and merge Result objects
6 1 our $VERSION = '1.1'; # VERSION
7  
8 has 'results' => (
9 is => 'ro', isa => 'ArrayRef[PGP::Finger::Result]', lazy => 1,
10 traits => [ 'Array' ],
11 0 ▶ default => sub { [] },
Subroutine __ANON__: not called CC=1 SCAR=6.9
12 1 handles => {
13 add_result => 'push',
14 count => 'count',
15 },
16 );
17  
18 0 ▶sub merged_keys {
Subroutine merged_keys: not called CC=4 SCAR=30.0
Pod undocumented
19 0 my $self = shift;
20 0 my %keys;
21  
22 0 foreach my $result ( @{$self->results} ) {
23 0 foreach my $key ( @{$result->keys} ) {
24 0 my $fp = $key->fingerprint;
25 0 ▶ if( defined $keys{$fp} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $keys{$fp}) { } 0 0 0
26 0 $keys{$fp}->merge_key( $key );
27 } else {
28 0 $keys{$fp} = $key->clone;
29 }
30 }
31 }
32  
33 0 return( values %keys );
34 }
35  
36 0 ▶sub as_string {
Subroutine as_string: not called CC=6 SCAR=37.4
Pod undocumented
37 0 my ( $self, $type ) = @_;
38 0 $type = lc $type;
39 0 my @keys = $self->merged_keys;
40 0 my $result = '';
41  
42 0 foreach my $key ( @keys ) {
43 0 ▶ if( $type eq 'armored' ) {
Branch: 4 branches
BranchTrueFalseTotal
if ($type eq 'armored') { } 0 0 0
elsif ($type eq 'binary') { } 0 0 0
elsif ($type eq 'generic') { } 0 0 0
elsif ($type eq 'rfc') { } 0 0 0
44 0 $result .= $key->armored;
45 } elsif ( $type eq 'binary' ){
46 0 $result .= $key->data;
47 } elsif ( $type eq 'generic' ){
48 0 $result .= $key->dns_record_generic;
49 } elsif ( $type eq 'rfc' ){
50 0 $result .= $key->dns_record_rfc;
51 } else {
52 0 die('invalid output format: '.$type);
53 }
54 }
55  
56 0 return $result;
57 }
58  
59 1 1;
60  
61 __END__
« Finger/DNS.pm ↑ Summary Finger/App.pm »