DNS/RR/OPENPGPKEY.pm

filter: Statementstmt 100% 36 / 36 Branchbran 100% 2 / 2 Conditioncond 100% 2 / 2 MC/DCmcdc 100% 1 / 1 Subroutinesub 100% 11 / 11 Podpod 100% 2 / 2 totaltotal 100% 54 / 54 CC 4 SCAR 4.5
CC
4
Cov
100%
keybin
3.0
key
2.0
BEGIN
1.0
CRAP 1.6
« DNS/RR/ISDN.pm ↑ Summary DNS/RR/EUI48.pm »
1 package Net::DNS::RR::OPENPGPKEY;
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: OPENPGPKEY.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::OPENPGPKEY - DNS OPENPGPKEY resource record
13  
14 =cut
15  
16 1 ▶use integer;
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 1 ▶use MIME::Base64;
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 $length = $self->{rdlength};
25 1 $self->keybin( substr $$data, $offset, $length );
26 1 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 'a*', $self->keybin;
34 }
35  
36  
37 3 ▶sub _format_rdata { ## format rdata portion of RR string.
Subroutine _format_rdata: called CC=1 SCAR=0.0
38 3 my $self = shift;
39  
40 3 my @base64 = split /\s+/, encode_base64( $self->keybin );
41 3 return @base64;
42 }
43  
44  
45 2 ▶sub _parse_rdata { ## populate RR from rdata in argument list
Subroutine _parse_rdata: called CC=1 SCAR=0.0
46 2 my ( $self, @argument ) = @_;
47  
48 2 $self->key(@argument);
49 2 return;
50 }
51  
52  
53 5 ▶sub key {
Subroutine key: called CC=2 SCAR=6.9
Pod documented
54 5 my ( $self, @value ) = @_;
55 5 ▶ return MIME::Base64::encode( $self->keybin(), "" ) unless scalar @value;
Branch: 1 branch
BranchTrueFalseTotal
unless scalar @value 2 3 5
56 3 return $self->keybin( MIME::Base64::decode( join "", @value ) );
57 }
58  
59  
60 16 ▶sub keybin {
Subroutine keybin: called CC=3 SCAR=11.0
Pod documented
61 16 my ( $self, @value ) = @_;
62 16 for (@value) { $self->{keybin} = $_ }
63 16 ▶ return $self->{keybin} || "";
Condition100%2/2
$self->{'keybin'} || ''
l!l
151
MC/DC100%1/1
$self->{'keybin'} || ''
$self->{'keybin'}
Truth table100%2/2
A
A= $self->{'keybin'}
Aresult
11
00
64 }
65  
66  
67 1 1;
68 __END__
« DNS/RR/ISDN.pm ↑ Summary DNS/RR/EUI48.pm »