blib/lib/Protocol/OTR/Account.pm

filter: Statementstmt 100% 33 / 33 Branchbran 75.0% 3 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 12 / 12 Podpod 100% 6 / 6 totaltotal 98.1% 54 / 55 CC 3 SCAR 3.6
CC
3
Cov
97%
_new
3.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.4
↑ Summary blib/lib/Protocol/OTR/Contact.pm »
1 # ABSTRACT: Off-the-Record Account (private key)
2 package Protocol::OTR::Account;
3 8 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
4 8 $Protocol::OTR::Account::AUTHORITY = 'cpan:AJGB';
5 }
6 8 $Protocol::OTR::Account::VERSION = '0.05';
7 8 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 8 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 8 ▶use Protocol::OTR::Contact ();
Subroutine BEGIN: called CC=1 SCAR=0.0
10 8 ▶use Params::Validate qw(validate validate_pos SCALAR BOOLEAN);
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 6 ▶sub _new {
Subroutine _new: called CC=3 SCAR=11.0
13 6 my ($class, $otr, $args, $find_only) = @_;
14  
15 6 ▶ my $m = $find_only ? "_find_account" : "_account";
Branch: 1 branch
BranchTrueFalseTotal
$find_only ? : 1 5 6
16  
17 6 $args->{fingerprint} = $otr->$m( $args->{name}, $args->{protocol} );
18  
19 6 ▶ return unless $args->{fingerprint};
Branch: 1 branch
BranchTrueFalseTotal
unless $args->{"fingerprint"} 0 6 6
20  
21 6 my $self = bless $args, $class;
22 6 $self->{otr} = $otr;
23  
24 6 return $self;
25 }
26  
27 1 ▶sub ctx {
Subroutine ctx: called CC=1 SCAR=0.0
Pod documented
28 1 return $_[0]->{otr};
29 }
30  
31 129 ▶sub name {
Subroutine name: called CC=1 SCAR=0.0
Pod documented
32 129 return $_[0]->{name};
33 }
34  
35 5 ▶sub protocol {
Subroutine protocol: called CC=1 SCAR=0.0
Pod documented
36 5 return $_[0]->{protocol};
37 }
38  
39 9 ▶sub fingerprint {
Subroutine fingerprint: called CC=1 SCAR=0.0
Pod documented
40 9 return $_[0]->{fingerprint};
41 }
42  
43 9 ▶sub contact {
Subroutine contact: called CC=1 SCAR=0.0
Pod documented
44 9 my $self = shift;
45  
46 9 my ($name, $fingerprint, $is_verified) = validate_pos(
47 @_,
48 {
49 type => SCALAR,
50 },
51 {
52 type => SCALAR,
53 optional => 1,
54 },
55 {
56 type => BOOLEAN,
57 optional => 1,
58 }
59 );
60  
61 7 return Protocol::OTR::Contact->_new(
62 $self,
63 {
64 name => $name,
65 fingerprint => $fingerprint,
66 is_verified => $is_verified,
67 }
68 );
69 }
70  
71 4 ▶sub contacts {
Subroutine contacts: called CC=1 SCAR=0.0
Pod documented
72 4 my ($self) = @_;
73  
74 return map {
75 6 Protocol::OTR::Contact->_new($self, { name => $_ } )
76 4 } @{ $self->_contacts() }
77 }
78  
79 8 1;
80  
81 __END__
↑ Summary blib/lib/Protocol/OTR/Contact.pm »