DNS/RR/SMIMEA.pm

filter: Statementstmt 100% 65 / 65 Branchbran 100% 4 / 4 Conditioncond 100% 8 / 8 MC/DCmcdc 100% 4 / 4 Subroutinesub 100% 17 / 17 Podpod 100% 7 / 7 totaltotal 100% 105 / 105 CC 12 SCAR 7.6
CC
12
Cov
100%
usage
3.0
selector
3.0
matchingtype
3.0
CRAP 2.1
« DNS/RR/DSYNC.pm ↑ Summary DNS/RR/TLSA.pm »
1 package Net::DNS::RR::SMIMEA;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 our $VERSION = (qw$Id: SMIMEA.pm 2003 2025-01-21 12:06:06Z willem $)[2];
6  
7 1 ▶use base qw(Net::DNS::RR);
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9  
10 =head1 NAME
11  
12 Net::DNS::RR::SMIMEA - DNS SMIMEA resource record
13  
14 =cut
15  
16 1 ▶use integer;
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 1 ▶use constant BABBLE => defined eval { require Digest::BubbleBabble };
Subroutine BEGIN: called CC=1 SCAR=0.0
21  
22  
23 sub _decode_rdata { ## decode rdata from wire-format octet string
24 1 ▶ my ( $self, $data, $offset ) = @_;
Subroutine _decode_rdata: called CC=1 SCAR=0.0
25  
26 1 my $next = $offset + $self->{rdlength};
27  
28 1 @{$self}{qw(usage selector matchingtype)} = unpack "\@$offset C3", $$data;
29 1 $offset += 3;
30 1 $self->{certbin} = substr $$data, $offset, $next - $offset;
31 1 return;
32 }
33  
34  
35 sub _encode_rdata { ## encode rdata as wire-format octet string
36 5 ▶ my $self = shift;
Subroutine _encode_rdata: called CC=1 SCAR=0.0
37  
38 5 return pack 'C3 a*', @{$self}{qw(usage selector matchingtype certbin)};
39 }
40  
41  
42 sub _format_rdata { ## format rdata portion of RR string.
43 3 ▶ my $self = shift;
Subroutine _format_rdata: called CC=1 SCAR=0.0
44  
45 3 $self->_annotation( $self->babble ) if BABBLE;
46 3 my @cert = split /(\S{64})/, $self->cert;
47 3 my @rdata = ( $self->usage, $self->selector, $self->matchingtype, @cert );
48 3 return @rdata;
49 }
50  
51  
52 sub _parse_rdata { ## populate RR from rdata in argument list
53 2 ▶ my ( $self, @argument ) = @_;
Subroutine _parse_rdata: called CC=2 SCAR=6.9
54  
55 2 for (qw(usage selector matchingtype)) { $self->$_( shift @argument ) }
56 2 $self->cert(@argument);
57 2 return;
58 }
59  
60  
61 sub usage {
62 8 ▶ my ( $self, @value ) = @_;
Subroutine usage: called CC=3 SCAR=11.0
Pod documented
63 8 for (@value) { $self->{usage} = 0 + $_ }
64 8 ▶ return $self->{usage} || 0;
Condition100%2/2
$self->{'usage'} || 0
l!l
71
MC/DC100%1/1
$self->{'usage'} || 0
$self->{'usage'}
Truth table100%2/2
A
A= $self->{'usage'}
Aresult
11
00
65 }
66  
67  
68 sub selector {
69 8 ▶ my ( $self, @value ) = @_;
Subroutine selector: called CC=3 SCAR=11.0
Pod documented
70 8 for (@value) { $self->{selector} = 0 + $_ }
71 8 ▶ return $self->{selector} || 0;
Condition100%2/2
$self->{'selector'} || 0
l!l
71
MC/DC100%1/1
$self->{'selector'} || 0
$self->{'selector'}
Truth table100%2/2
A
A= $self->{'selector'}
Aresult
11
00
72 }
73  
74  
75 sub matchingtype {
76 8 ▶ my ( $self, @value ) = @_;
Subroutine matchingtype: called CC=3 SCAR=11.0
Pod documented
77 8 for (@value) { $self->{matchingtype} = 0 + $_ }
78 8 ▶ return $self->{matchingtype} || 0;
Condition100%2/2
$self->{'matchingtype'} || 0
l!l
71
MC/DC100%1/1
$self->{'matchingtype'} || 0
$self->{'matchingtype'}
Truth table100%2/2
A
A= $self->{'matchingtype'}
Aresult
11
00
79 }
80  
81  
82 sub cert {
83 9 ▶ my ( $self, @value ) = @_;
Subroutine cert: called CC=3 SCAR=11.0
Pod documented
84 9 ▶ return unpack "H*", $self->certbin() unless scalar @value;
Branch: 1 branch
BranchTrueFalseTotal
unless scalar @value 5 4 9
85 4 ▶ my @hex = map { /^"*([\dA-Fa-f]*)"*$/ || croak("corrupt hex"); $1 } @value;
Branch: 1 branch
BranchTrueFalseTotal
/^"*([\dA-Fa-f]*)"*$/ or croak("corrupt hex") 1 3 4
86 3 return $self->certbin( pack "H*", join "", @hex );
87 }
88  
89  
90 sub certbin {
91 15 ▶ my ( $self, @value ) = @_;
Subroutine certbin: called CC=3 SCAR=11.0
Pod documented
92 15 for (@value) { $self->{certbin} = $_ }
93 15 ▶ return $self->{certbin} || "";
Condition100%2/2
$self->{'certbin'} || ''
l!l
141
MC/DC100%1/1
$self->{'certbin'} || ''
$self->{'certbin'}
Truth table100%2/2
A
A= $self->{'certbin'}
Aresult
11
00
94 }
95  
96  
97 4 ▶sub certificate { return &cert; }
Subroutine certificate: called CC=1 SCAR=0.0
Pod documented
98  
99  
100 sub babble {
101 5 ▶ return BABBLE ? Digest::BubbleBabble::bubblebabble( Digest => shift->certbin ) : '';
Subroutine babble: called CC=1 SCAR=0.0
Pod documented
102 }
103  
104  
105 1 1;
106 __END__
« DNS/RR/DSYNC.pm ↑ Summary DNS/RR/TLSA.pm »