DNS/RR/CAA.pm

filter: Statementstmt 100% 53 / 53 Branchbran 100% 8 / 8 Conditioncond 100% 2 / 2 MC/DCmcdc 100% 1 / 1 Subroutinesub 100% 14 / 14 Podpod 100% 4 / 4 totaltotal 100% 82 / 82 CC 10 SCAR 8.3
CC
10
Cov
100%
critical
4.0
flags
3.0
tag
3.0
CRAP 2.3
« DNS/RR/HIP.pm ↑ Summary DNS/RR/TKEY.pm »
1 package Net::DNS::RR::CAA;
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: CAA.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::CAA - DNS CAA resource record
13  
14 =cut
15  
16 1 ▶use integer;
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 1 ▶use Net::DNS::Text;
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20  
21 1 ▶sub _decode_rdata { ## decode rdata from wire-format octet string
Subroutine _decode_rdata: called CC=1 SCAR=0.0
22 1 my ( $self, $data, $offset ) = @_;
23  
24 1 my $limit = $offset + $self->{rdlength};
25 1 $self->{flags} = unpack "\@$offset C", $$data;
26 1 ( $self->{tag}, $offset ) = Net::DNS::Text->decode( $data, $offset + 1 );
27 1 $self->{value} = Net::DNS::Text->decode( $data, $offset, $limit - $offset );
28 1 return;
29 }
30  
31  
32 5 ▶sub _encode_rdata { ## encode rdata as wire-format octet string
Subroutine _encode_rdata: called CC=1 SCAR=0.0
33 5 my $self = shift;
34  
35 5 return pack 'C a* a*', $self->flags, $self->{tag}->encode, $self->{value}->raw;
36 }
37  
38  
39 3 ▶sub _format_rdata { ## format rdata portion of RR string.
Subroutine _format_rdata: called CC=1 SCAR=0.0
40 3 my $self = shift;
41  
42 3 my @rdata = ( $self->flags, $self->{tag}->string, $self->{value}->string );
43 3 return @rdata;
44 }
45  
46  
47 1 ▶sub _parse_rdata { ## populate RR from rdata in argument list
Subroutine _parse_rdata: called CC=1 SCAR=0.0
48 1 my ( $self, @argument ) = @_;
49  
50 1 $self->flags( shift @argument );
51 1 $self->tag( lc shift @argument );
52 1 $self->value( shift @argument );
53 1 return;
54 }
55  
56  
57 1 ▶sub _defaults { ## specify RR attribute default values
Subroutine _defaults: called CC=1 SCAR=0.0
58 1 my $self = shift;
59  
60 1 $self->flags(0);
61 1 return;
62 }
63  
64  
65 15 ▶sub flags {
Subroutine flags: called CC=3 SCAR=11.0
Pod documented
66 15 my ( $self, @value ) = @_;
67 15 for (@value) { $self->{flags} = 0 + $_ }
68 15 ▶ return $self->{flags} || 0;
Condition100%2/2
$self->{'flags'} || 0
l!l
114
MC/DC100%1/1
$self->{'flags'} || 0
$self->{'flags'}
Truth table100%2/2
A
A= $self->{'flags'}
Aresult
11
00
69 }
70  
71  
72 4 ▶sub critical {
Subroutine critical: called CC=4 SCAR=13.9
Pod documented
73 4 my ( $self, @value ) = @_;
74 4 ▶ if ( scalar @value ) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @value) 2 2 4
75 2 for ( $self->{flags} |= 0x80 ) {
76 2 ▶ $_ ^= 0x80 unless shift @value;
Branch: 1 branch
BranchTrueFalseTotal
unless shift @value 1 1 2
77 }
78 }
79 4 return $self->{flags} & 0x80;
80 }
81  
82  
83 5 ▶sub tag {
Subroutine tag: called CC=3 SCAR=11.0
Pod documented
84 5 my ( $self, @value ) = @_;
85 5 for (@value) { $self->{tag} = Net::DNS::Text->new($_) }
86 5 ▶ return $self->{tag} ? $self->{tag}->value : undef;
Branch: 1 branch
BranchTrueFalseTotal
$self->{'tag'} ? : 4 1 5
87 }
88  
89  
90 5 ▶sub value {
Subroutine value: called CC=3 SCAR=11.0
Pod documented
91 5 my ( $self, @value ) = @_;
92 5 for (@value) { $self->{value} = Net::DNS::Text->new($_) }
93 5 ▶ return $self->{value} ? $self->{value}->value : undef;
Branch: 1 branch
BranchTrueFalseTotal
$self->{'value'} ? : 4 1 5
94 }
95  
96  
97 1 1;
98 __END__
« DNS/RR/HIP.pm ↑ Summary DNS/RR/TKEY.pm »