DNS/RR/NSEC3PARAM.pm

filter: Statementstmt 100% 57 / 57 Branchbran 100% 6 / 6 Conditioncond 100% 10 / 10 MC/DCmcdc 100% 5 / 5 Subroutinesub 100% 15 / 15 Podpod 100% 5 / 6 (1 uncoverable) totaltotal 100% 98 / 99 (1 uncoverable) CC 14 SCAR 8.6
CC
14
Cov
100%
_parse_rdata
3.0
algorithm
3.0
flags
3.0
CRAP 2.4
« DNS/RR/URI.pm ↑ Summary DNS/RR/HIP.pm »
1 package Net::DNS::RR::NSEC3PARAM;
2  
3 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 our $VERSION = (qw$Id: NSEC3PARAM.pm 2003 2025-01-21 12:06:06Z willem $)[2];
6  
7 3 ▶use base qw(Net::DNS::RR);
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9  
10 =head1 NAME
11  
12 Net::DNS::RR::NSEC3PARAM - DNS NSEC3PARAM resource record
13  
14 =cut
15  
16 3 ▶use integer;
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 3 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20  
21 4 ▶sub _decode_rdata { ## decode rdata from wire-format octet string
Subroutine _decode_rdata: called CC=1 SCAR=0.0
22 4 my ( $self, $data, $offset ) = @_;
23  
24 4 my $size = unpack "\@$offset x4 C", $$data;
25 4 @{$self}{qw(algorithm flags iterations saltbin)} = unpack "\@$offset CCnx a$size", $$data;
26 4 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 my $salt = $self->saltbin;
34 5 return pack 'CCnCa*', @{$self}{qw(algorithm flags iterations)}, length($salt), $salt;
35 }
36  
37  
38 3 ▶sub _format_rdata { ## format rdata portion of RR string.
Subroutine _format_rdata: called CC=2 SCAR=6.9
39 3 my $self = shift;
40  
41 3 ▶ return join ' ', $self->algorithm, $self->flags, $self->iterations, $self->salt || '-';
Condition100%2/2
$self->salt || '-'
l!l
21
MC/DC100%1/1
$self->salt || '-'
$self->salt
Truth table100%2/2
A
A= $self->salt
Aresult
11
00
42 }
43  
44  
45 4 ▶sub _parse_rdata { ## populate RR from rdata in argument list
Subroutine _parse_rdata: called CC=3 SCAR=11.0
46 4 my ( $self, @argument ) = @_;
47  
48 4 for (qw(algorithm flags iterations)) { $self->$_( shift @argument ) }
49 4 my $salt = shift @argument;
50 4 ▶ $self->salt($salt) unless $salt eq '-';
Branch: 1 branch
BranchTrueFalseTotal
unless $salt eq "-" 3 1 4
51 3 return;
52 }
53  
54  
55 13 ▶sub algorithm {
Subroutine algorithm: called CC=3 SCAR=11.0
Pod documented
56 13 my ( $self, @value ) = @_;
57 13 for (@value) { $self->{algorithm} = 0 + $_ }
58 13 ▶ return $self->{algorithm} || 0;
Condition100%2/2
$self->{'algorithm'} || 0
l!l
121
MC/DC100%1/1
$self->{'algorithm'} || 0
$self->{'algorithm'}
Truth table100%2/2
A
A= $self->{'algorithm'}
Aresult
11
00
59 }
60  
61  
62 10 ▶sub flags {
Subroutine flags: called CC=3 SCAR=11.0
Pod documented
63 10 my ( $self, @value ) = @_;
64 10 for (@value) { $self->{flags} = 0 + $_ }
65 10 ▶ return $self->{flags} || 0;
Condition100%2/2
$self->{'flags'} || 0
l!l
55
MC/DC100%1/1
$self->{'flags'} || 0
$self->{'flags'}
Truth table100%2/2
A
A= $self->{'flags'}
Aresult
11
00
66 }
67  
68  
69 11 ▶sub iterations {
Subroutine iterations: called CC=3 SCAR=11.0
Pod documented
70 11 my ( $self, @value ) = @_;
71 11 for (@value) { $self->{iterations} = 0 + $_ }
72 11 ▶ return $self->{iterations} || 0;
Condition100%2/2
$self->{'iterations'} || 0
l!l
101
MC/DC100%1/1
$self->{'iterations'} || 0
$self->{'iterations'}
Truth table100%2/2
A
A= $self->{'iterations'}
Aresult
11
00
73 }
74  
75  
76 10 ▶sub salt {
Subroutine salt: called CC=3 SCAR=11.0
Pod documented
77 10 my ( $self, @value ) = @_;
78 10 ▶ return unpack "H*", $self->saltbin() unless scalar @value;
Branch: 1 branch
BranchTrueFalseTotal
unless scalar @value 6 4 10
79 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
80 3 return $self->saltbin( pack "H*", join "", @hex );
81 }
82  
83  
84 15 ▶sub saltbin {
Subroutine saltbin: called CC=3 SCAR=11.0
Pod documented
85 15 my ( $self, @value ) = @_;
86 15 for (@value) { $self->{saltbin} = $_ }
87 15 ▶ return $self->{saltbin} || "";
Condition100%2/2
$self->{'saltbin'} || ''
l!l
123
MC/DC100%1/1
$self->{'saltbin'} || ''
$self->{'saltbin'}
Truth table100%2/2
A
A= $self->{'saltbin'}
Aresult
11
00
88 }
89  
90  
91 ########################################
92  
93 2 ▶sub hashalgo { return &algorithm; } # uncoverable pod
Subroutine hashalgo: called CC=1 SCAR=0.0
Pod undocumented (uncoverable)
94  
95 ########################################
96  
97  
98 3 1;
99 __END__
« DNS/RR/URI.pm ↑ Summary DNS/RR/HIP.pm »