| 1 | package Net::DNS::RR::L32; | ||||||||||||
| 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: L32.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::L32 - DNS L32 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}{qw(preference locator32)} = unpack "\@$offset n a4", $$data; | |||||||||||
| 23 | 1 | return; | |||||||||||
| 24 | } | ||||||||||||
| 25 | |||||||||||||
| 26 | |||||||||||||
| 27 | 5 | ▶ | sub _encode_rdata { ## encode rdata as wire-format octet string | ||||||||||
|
Subroutine
_encode_rdata: called CC=1 SCAR=0.0
| |||||||||||||
| 28 | 5 | my $self = shift; | |||||||||||
| 29 | |||||||||||||
| 30 | 5 | return pack 'n a4', $self->{preference}, $self->{locator32}; | |||||||||||
| 31 | } | ||||||||||||
| 32 | |||||||||||||
| 33 | |||||||||||||
| 34 | 2 | ▶ | sub _format_rdata { ## format rdata portion of RR string. | ||||||||||
|
Subroutine
_format_rdata: called CC=1 SCAR=0.0
| |||||||||||||
| 35 | 2 | my $self = shift; | |||||||||||
| 36 | |||||||||||||
| 37 | 2 | return join ' ', $self->preference, $self->locator32; | |||||||||||
| 38 | } | ||||||||||||
| 39 | |||||||||||||
| 40 | |||||||||||||
| 41 | 1 | ▶ | sub _parse_rdata { ## populate RR from rdata in argument list | ||||||||||
|
Subroutine
_parse_rdata: called CC=2 SCAR=6.9
| |||||||||||||
| 42 | 1 | my ( $self, @argument ) = @_; | |||||||||||
| 43 | |||||||||||||
| 44 | 1 | for (qw(preference locator32)) { $self->$_( shift @argument ) } | |||||||||||
| 45 | 1 | return; | |||||||||||
| 46 | } | ||||||||||||
| 47 | |||||||||||||
| 48 | |||||||||||||
| 49 | 6 | ▶ | sub preference { | ||||||||||
|
Subroutine
preference: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||
| 50 | 6 | my ( $self, @value ) = @_; | |||||||||||
| 51 | 6 | for (@value) { $self->{preference} = 0 + $_ } | |||||||||||
| 52 | 6 | ▶ | 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'}
| |||||||||||||
| 53 | } | ||||||||||||
| 54 | |||||||||||||
| 55 | |||||||||||||
| 56 | 6 | ▶ | sub locator32 { | ||||||||||
|
Subroutine
locator32: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||
| 57 | 6 | my $self = shift; | |||||||||||
| 58 | 6 | my $prfx = shift; | |||||||||||
| 59 | |||||||||||||
| 60 | 6 | ▶ | $self->{locator32} = pack 'C* @4', split /\./, $prfx if defined $prfx; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 61 | |||||||||||||
| 62 | 6 | ▶ | return $self->{locator32} ? join( '.', unpack 'C4', $self->{locator32} ) : undef; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 63 | } | ||||||||||||
| 64 | |||||||||||||
| 65 | |||||||||||||
| 66 | 0 | ▶ | my $function = sub { ## sort RRs in numerically ascending order. | ||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||
| 67 | 0 | return $Net::DNS::a->{'preference'} <=> $Net::DNS::b->{'preference'}; | |||||||||||
| 68 | 1 | }; | |||||||||||
| 69 | |||||||||||||
| 70 | 1 | __PACKAGE__->set_rrsort_func( 'preference', $function ); | |||||||||||
| 71 | |||||||||||||
| 72 | 1 | __PACKAGE__->set_rrsort_func( 'default_sort', $function ); | |||||||||||
| 73 | |||||||||||||
| 74 | |||||||||||||
| 75 | 1 | 1; | |||||||||||
| 76 | __END__ | ||||||||||||