| 1 | package Net::DNS::RR::LP; | ||||||||||||
| 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: LP.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::LP - DNS LP resource record | ||||||||||||
| 13 | |||||||||||||
| 14 | =cut | ||||||||||||
| 15 | |||||||||||||
| 16 | 1 | ▶ | use integer; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 17 | |||||||||||||
| 18 | |||||||||||||
| 19 | 1 | ▶ | sub _decode_rdata { ## decode rdata from wire-format octet string | ||||||||||
|
Subroutine
_decode_rdata: called CC=1 SCAR=0.0
| |||||||||||||
| 20 | 1 | my ( $self, $data, $offset ) = @_; | |||||||||||
| 21 | |||||||||||||
| 22 | 1 | $self->{preference} = unpack( "\@$offset n", $$data ); | |||||||||||
| 23 | 1 | $self->{target} = Net::DNS::DomainName->decode( $data, $offset + 2 ); | |||||||||||
| 24 | 1 | return; | |||||||||||
| 25 | } | ||||||||||||
| 26 | |||||||||||||
| 27 | |||||||||||||
| 28 | 5 | ▶ | sub _encode_rdata { ## encode rdata as wire-format octet string | ||||||||||
|
Subroutine
_encode_rdata: called CC=1 SCAR=0.0
| |||||||||||||
| 29 | 5 | my $self = shift; | |||||||||||
| 30 | |||||||||||||
| 31 | 5 | my $target = $self->{target}; | |||||||||||
| 32 | 5 | return pack 'n a*', $self->preference, $target->encode(); | |||||||||||
| 33 | } | ||||||||||||
| 34 | |||||||||||||
| 35 | |||||||||||||
| 36 | 2 | ▶ | sub _format_rdata { ## format rdata portion of RR string. | ||||||||||
|
Subroutine
_format_rdata: called CC=1 SCAR=0.0
| |||||||||||||
| 37 | 2 | my $self = shift; | |||||||||||
| 38 | |||||||||||||
| 39 | 2 | my $target = $self->{target}; | |||||||||||
| 40 | 2 | return join ' ', $self->preference, $target->string; | |||||||||||
| 41 | } | ||||||||||||
| 42 | |||||||||||||
| 43 | |||||||||||||
| 44 | 1 | ▶ | sub _parse_rdata { ## populate RR from rdata in argument list | ||||||||||
|
Subroutine
_parse_rdata: called CC=2 SCAR=6.9
| |||||||||||||
| 45 | 1 | my ( $self, @argument ) = @_; | |||||||||||
| 46 | |||||||||||||
| 47 | 1 | for (qw(preference target)) { $self->$_( shift @argument ) } | |||||||||||
| 48 | 1 | return; | |||||||||||
| 49 | } | ||||||||||||
| 50 | |||||||||||||
| 51 | |||||||||||||
| 52 | 11 | ▶ | sub preference { | ||||||||||
|
Subroutine
preference: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||
| 53 | 11 | my ( $self, @value ) = @_; | |||||||||||
| 54 | 11 | for (@value) { $self->{preference} = 0 + $_ } | |||||||||||
| 55 | 11 | ▶ | return $self->{preference} || 0; | ||||||||||
|
Condition100%2/2
$self->{'preference'} || 0
MC/DC100%1/1
$self->{'preference'} || 0
$self->{'preference'}
Truth table100%2/2
A
A= $self->{'preference'}
| |||||||||||||
| 56 | } | ||||||||||||
| 57 | |||||||||||||
| 58 | |||||||||||||
| 59 | 4 | ▶ | sub target { | ||||||||||
|
Subroutine
target: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||
| 60 | 4 | my ( $self, @value ) = @_; | |||||||||||
| 61 | 4 | for (@value) { $self->{target} = Net::DNS::DomainName->new($_) } | |||||||||||
| 62 | 4 | ▶ | return $self->{target} ? $self->{target}->name : undef; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 63 | } | ||||||||||||
| 64 | |||||||||||||
| 65 | |||||||||||||
| 66 | 2 | ▶ | sub FQDN { return shift->{target}->fqdn; } | ||||||||||
|
Subroutine
FQDN: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||
| 67 | 2 | ▶ | sub fqdn { return shift->{target}->fqdn; } | ||||||||||
|
Subroutine
fqdn: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||
| 68 | |||||||||||||
| 69 | |||||||||||||
| 70 | 0 | ▶ | my $function = sub { ## sort RRs in numerically ascending order. | ||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||
| 71 | 0 | return $Net::DNS::a->{'preference'} <=> $Net::DNS::b->{'preference'}; | |||||||||||
| 72 | 1 | }; | |||||||||||
| 73 | |||||||||||||
| 74 | 1 | __PACKAGE__->set_rrsort_func( 'preference', $function ); | |||||||||||
| 75 | |||||||||||||
| 76 | 1 | __PACKAGE__->set_rrsort_func( 'default_sort', $function ); | |||||||||||
| 77 | |||||||||||||
| 78 | |||||||||||||
| 79 | 1 | 1; | |||||||||||
| 80 | __END__ | ||||||||||||