| 1 | #!/usr/bin/false | ||||||||||||||||||||||||||||
| 2 | # ABSTRACT: UNICAST option (code 12) — server IPv6 address | ||||||||||||||||||||||||||||
| 3 | # PODNAME: Net::DHCPv6::Option::Unicast | ||||||||||||||||||||||||||||
| 4 | package Net::DHCPv6::Option::Unicast; | ||||||||||||||||||||||||||||
| 5 | 15 | $Net::DHCPv6::Option::Unicast::VERSION = '0.001'; | |||||||||||||||||||||||||||
| 6 | 15 | ▶ | use strictures 2; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 15 | ▶ | use Carp qw(croak); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | 15 | ▶ | use Net::DHCPv6::Constants; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | 15 | ▶ | use Net::DHCPv6::X::Truncated; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | 15 | ▶ | use parent 'Net::DHCPv6::Option'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | 15 | ▶ | use namespace::clean; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | sub new { | ||||||||||||||||||||||||||||
| 14 | 6 | ▶ | my ( $class, %args ) = @_; | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||
| 15 | croak 'Unicast requires address' | ||||||||||||||||||||||||||||
| 16 | unless $args{address} | ||||||||||||||||||||||||||||
| 17 | 6 | ▶ | && CORE::length( $args{address} ) == 16; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$args{"address"} and length $args{"address"} == 16
MC/DC100%2/2
$args{"address"} and length $args{"address"} == 16
$args{"address"}
length $args{"address"} == 16
Truth table100%3/3
A and B
A= $args{"address"}B= length $args{"address"} == 16
| |||||||||||||||||||||||||||||
| 18 | 4 | $args{code} = $OPTION_UNICAST; | |||||||||||||||||||||||||||
| 19 | 4 | $args{data} = $args{address}; | |||||||||||||||||||||||||||
| 20 | 4 | my $self = $class->SUPER::new( %args ); | |||||||||||||||||||||||||||
| 21 | 4 | $self->{address} = $args{address}; | |||||||||||||||||||||||||||
| 22 | 4 | bless $self, $class; | |||||||||||||||||||||||||||
| 23 | } | ||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | 2 | ▶ | sub address { shift->{address} } | ||||||||||||||||||||||||||
|
Subroutine
address: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | sub from_bytes_inner { | ||||||||||||||||||||||||||||
| 28 | 2 | ▶ | my ( $class, $code, $data ) = @_; | ||||||||||||||||||||||||||
|
Subroutine
from_bytes_inner: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||
| 29 | 2 | ▶ | Net::DHCPv6::X::Truncated->throw( message => 'Truncated Unicast option' ) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 30 | if CORE::length( $data ) < 16; | ||||||||||||||||||||||||||||
| 31 | 2 | return $class->new( address => substr( $data, 0, 16 ) ); | |||||||||||||||||||||||||||
| 32 | } | ||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | 15 | $Net::DHCPv6::OptionList::OPTION_CLASS{$OPTION_UNICAST} = __PACKAGE__; | |||||||||||||||||||||||||||
| 35 | 15 | 1; | |||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | __END__ | ||||||||||||||||||||||||||||