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 1 ▶sub _decode_rdata { ## decode rdata from wire-format octet string
Subroutine _decode_rdata: called CC=1 SCAR=0.0
24 1 my ( $self, $data, $offset ) = @_;
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 5 ▶sub _encode_rdata { ## encode rdata as wire-format octet string
Subroutine _encode_rdata: called CC=1 SCAR=0.0
36 5 my $self = shift;
37  
38 5 return pack 'C3 a*', @{$self}{qw(usage selector matchingtype certbin)};
39 }
40  
41  
42 3 ▶sub _format_rdata { ## format rdata portion of RR string.
Subroutine _format_rdata: called CC=1 SCAR=0.0
43 3 my $self = shift;
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 2 ▶sub _parse_rdata { ## populate RR from rdata in argument list
Subroutine _parse_rdata: called CC=2 SCAR=6.9
53 2 my ( $self, @argument ) = @_;
54  
55 2 for (qw(usage selector matchingtype)) { $self->$_( shift @argument ) }
56 2 $self->cert(@argument);
57 2 return;
58 }
59  
60  
61 8 ▶sub usage {
Subroutine usage: called CC=3 SCAR=11.0
Pod documented
62 8 my ( $self, @value ) = @_;
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 8 ▶sub selector {
Subroutine selector: called CC=3 SCAR=11.0
Pod documented
69 8 my ( $self, @value ) = @_;
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 8 ▶sub matchingtype {
Subroutine matchingtype: called CC=3 SCAR=11.0
Pod documented
76 8 my ( $self, @value ) = @_;
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 9 ▶sub cert {
Subroutine cert: called CC=3 SCAR=11.0
Pod documented
83 9 my ( $self, @value ) = @_;
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") 3 1 4
86 3 return $self->certbin( pack "H*", join "", @hex );
87 }
88  
89  
90 15 ▶sub certbin {
Subroutine certbin: called CC=3 SCAR=11.0
Pod documented
91 15 my ( $self, @value ) = @_;
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 5 ▶sub babble {
Subroutine babble: called CC=1 SCAR=0.0
Pod documented
101 5 return BABBLE ? Digest::BubbleBabble::bubblebabble( Digest => shift->certbin ) : '';
102 }
103  
104  
105 1 1;
106 __END__
« DNS/RR/DSYNC.pm ↑ Summary DNS/RR/TLSA.pm »