DKIM/ARC/MessageSignature.pm

filter: Statementstmt 100% 39 / 39 Branchbran 77.7% 14 / 18 Conditioncond 60.0% 3 / 5 MC/DCmcdc 33.3% 1 / 3 Subroutinesub 100% 7 / 7 Podpod 66.6% 2 / 3 totaltotal 88.0% 66 / 75 CC 12 SCAR 17.5
CC
12
Cov
90%
new
9.1
instance
4.2
BEGIN
1.0
CRAP 5.7
« DKIM/Canonicalization/seal.pm ↑ Summary DKIM/ARC/Seal.pm »
1 package Mail::DKIM::ARC::MessageSignature;
2 6 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 6 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 6 our $VERSION = '1.20261116'; # VERSION
5 # ABSTRACT: Subclass of Mail::DKIM::Signature which represents a ARC-Message-Signature header
6  
7 # Copyright 2017 FastMail Pty Ltd. All Rights Reserved.
8 # Bron Gondwana <brong@fastmailteam.com>
9  
10 # This program is free software; you can redistribute it and/or
11 # modify it under the same terms as Perl itself.
12  
13 6 ▶use base 'Mail::DKIM::Signature';
Subroutine BEGIN: called CC=1 SCAR=0.0
14 6 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16  
17 579 ▶sub new {
Subroutine new: called CC=9 SCAR=22.0
Pod documented
18 579 my $class = shift;
19 579 my %prms = @_;
20 579 my $self = {};
21 579 bless $self, $class;
22  
23 579 ▶ $self->instance( $prms{'Instance'} ) if exists $prms{'Instance'};
Branch: 1 branch
BranchTrueFalseTotal
if exists $prms{"Instance"} 21 558 579
24 579 ▶ $self->algorithm( $prms{'Algorithm'} || 'rsa-sha256' );
Condition100%2/2
$prms{'Algorithm'} || 'rsa-sha256'
l!l
21558
MC/DC100%1/1
$prms{'Algorithm'} || 'rsa-sha256'
$prms{'Algorithm'}
Truth table100%2/2
A
A= $prms{'Algorithm'}
Aresult
11
00
25 579 $self->signature( $prms{'Signature'} );
26 579 ▶ $self->canonicalization( $prms{'Method'} ) if exists $prms{'Method'};
Branch: 1 branch
BranchTrueFalseTotal
if exists $prms{"Method"} 21 558 579
27 579 $self->domain( $prms{'Domain'} );
28 579 $self->headerlist( $prms{'Headers'} );
29 579 ▶ $self->protocol( $prms{'Query'} ) if exists $prms{'Query'};
Branch: 1 branch
BranchTrueFalseTotal
if exists $prms{"Query"} 0 579 579
30 579 $self->selector( $prms{'Selector'} );
31 579 ▶ $self->timestamp( $prms{'Timestamp'} ) if defined $prms{'Timestamp'};
Branch: 1 branch
BranchTrueFalseTotal
if defined $prms{"Timestamp"} 16 563 579
32 579 ▶ $self->expiration( $prms{'Expiration'} ) if defined $prms{'Expiration'};
Branch: 1 branch
BranchTrueFalseTotal
if defined $prms{"Expiration"} 0 579 579
33 579 ▶ $self->tags( $prms{'Tags'} ) if defined $prms{'Tags'};
Branch: 1 branch
BranchTrueFalseTotal
if defined $prms{"Tags"} 0 579 579
34 579 ▶ $self->key( $prms{'Key'} ) if defined $prms{'Key'};
Branch: 1 branch
BranchTrueFalseTotal
if defined $prms{"Key"} 21 558 579
35  
36 579 return $self;
37 }
38  
39 642 ▶sub DEFAULT_PREFIX {
Subroutine DEFAULT_PREFIX: called CC=1 SCAR=0.0
Pod undocumented
40 642 return 'ARC-Message-Signature:';
41 }
42  
43  
44 1033 ▶sub instance {
Subroutine instance: called CC=4 SCAR=14.2
Pod documented
45 1033 my $self = shift;
46  
47 # ARC identities must be a number
48 1033 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 42 991 1033
49 42 my $val = int(shift);
50 42 ▶ die "INVALID instance $val" unless ( $val > 0 and $val < 1025 );
Branch: 1 branch
BranchTrueFalseTotal
unless $val > 0 and $val < 1025 0 42 42
Condition33%1/3
$val > 0 and $val < 1025
!ll&&!rl&&r
0042
MC/DC0%0/2
$val > 0 and $val < 1025
$val > 0 $val < 1025
Truth table33%1/3
A and B
A= $val > 0B= $val < 1025
ABresult
0X0
100
111
51 42 $self->set_tag( 'i', $val );
52 }
53  
54 1033 my $i = $self->get_tag('i');
55 1033 return $i;
56 }
57  
58  
59 6 1;
60  
61 __END__
« DKIM/Canonicalization/seal.pm ↑ Summary DKIM/ARC/Seal.pm »