DNS/RR/TXT.pm

filter: Statementstmt 100% 50 / 50 Branchbran 100% 8 / 8 Conditioncond 100% 2 / 2 MC/DCmcdc 100% 1 / 1 Subroutinesub 100% 12 / 12 Podpod 100% 1 / 2 (1 uncoverable) totaltotal 100% 74 / 75 (1 uncoverable) CC 6 SCAR 8.3
CC
6
Cov
100%
txtdata
5.0
_decode_rdata
2.0
BEGIN
1.0
CRAP 2.3
« DNS/RR/TKEY.pm ↑ Summary DNS/RR/ZONEMD.pm »
1 package Net::DNS::RR::TXT;
2  
3 8 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 8 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 8 our $VERSION = (qw$Id: TXT.pm 2003 2025-01-21 12:06:06Z willem $)[2];
6  
7 8 ▶use base qw(Net::DNS::RR);
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 =encoding utf8
10  
11  
12 =head1 NAME
13  
14 Net::DNS::RR::TXT - DNS TXT resource record
15  
16 =cut
17  
18 8 ▶use integer;
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 8 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
21 8 ▶use Net::DNS::Text;
Subroutine BEGIN: called CC=1 SCAR=0.0
22  
23  
24 8408 ▶sub _decode_rdata { ## decode rdata from wire-format octet string
Subroutine _decode_rdata: called CC=2 SCAR=6.9
25 8408 my ( $self, $data, $offset ) = @_;
26  
27 8408 my $limit = $self->{rdlength};
28 8408 my $rdata = substr $$data, $offset, $limit;
29 8408 my $array = $self->{txtdata} = [];
30 8408 my $index = 0;
31 8408 ▶ while ( $index < $limit ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($index < $limit) 16549 8407 24956
32 16549 ( my $text, $index ) = Net::DNS::Text->decode( \$rdata, $index );
33 16548 push @$array, $text;
34 }
35 8407 return;
36 }
37  
38  
39 295 ▶sub _encode_rdata { ## encode rdata as wire-format octet string
Subroutine _encode_rdata: called CC=1 SCAR=0.0
40 295 my $self = shift;
41  
42 295 my $txtdata = $self->{txtdata};
43 295 return join '', map { $_->encode } @$txtdata;
44 }
45  
46  
47 883 ▶sub _format_rdata { ## format rdata portion of RR string.
Subroutine _format_rdata: called CC=1 SCAR=0.0
48 883 my $self = shift;
49  
50 883 my $txtdata = $self->{txtdata};
51 883 return ( map { $_->unicode } @$txtdata );
52 }
53  
54  
55 391 ▶sub _parse_rdata { ## populate RR from rdata in argument list
Subroutine _parse_rdata: called CC=1 SCAR=0.0
56 391 my ( $self, @argument ) = @_;
57  
58 391 $self->{txtdata} = [map { Net::DNS::Text->new($_) } @argument];
59 391 return;
60 }
61  
62  
63 11 ▶sub txtdata {
Subroutine txtdata: called CC=5 SCAR=16.1
Pod documented
64 11 my ( $self, @value ) = @_;
65  
66 11 ▶ $self->{txtdata} = [map { Net::DNS::Text->new($_) } @value] if scalar @value;
Branch: 1 branch
BranchTrueFalseTotal
if scalar @value 2 9 11
67  
68 11 ▶ my $txtdata = $self->{txtdata} || [];
Condition100%2/2
$self->{'txtdata'} || []
l!l
101
MC/DC100%1/1
$self->{'txtdata'} || []
$self->{'txtdata'}
Truth table100%2/2
A
A= $self->{'txtdata'}
Aresult
11
00
69  
70 11 ▶ return ( map { $_->value } @$txtdata ) if wantarray;
Branch: 1 branch
BranchTrueFalseTotal
if wantarray 6 5 11
71  
72 5 ▶ return defined(wantarray) ? join( ' ', map { $_->value } @$txtdata ) : '';
Branch: 1 branch
BranchTrueFalseTotal
defined wantarray ? : 4 1 5
73 }
74  
75  
76 5 ▶sub char_str_list { return my @txt = &txtdata } # uncoverable pod
Subroutine char_str_list: called CC=1 SCAR=0.0
Pod undocumented (uncoverable)
77  
78  
79 8 1;
80 __END__
« DNS/RR/TKEY.pm ↑ Summary DNS/RR/ZONEMD.pm »