DNS/RR/ZONEMD.pm

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