lib/Net/DHCPv6/Option/Unicast.pm

filter: Statementstmt 100% 38 / 38 Branchbran 75.0% 3 / 4 Conditioncond 66.6% 2 / 3 MC/DCmcdc 50.0% 1 / 2 Subroutinesub 100% 11 / 11 Podpod 100% 4 / 4 totaltotal 95.1% 59 / 62 CC 4 SCAR 4.6
CC
4
Cov
96%
new
3.0
from_bytes_inner
2.0
BEGIN
1.0
CRAP 1.6
« lib/Net/DHCPv6/Option/StatusCode.pm ↑ Summary lib/Net/DHCPv6/Option/ClientLinkLayerAddr.pm »
1 #!/bin/false
2 # ABSTRACT: UNICAST option (code 12) -- server IPv6 address
3 # PODNAME: Net::DHCPv6::Option::Unicast
4 15 ▶use strictures 2;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 package Net::DHCPv6::Option::Unicast;
7 15 $Net::DHCPv6::Option::Unicast::VERSION = '0.003';
8 15 ▶use Net::DHCPv6::OptionList ();
Subroutine BEGIN: called CC=1 SCAR=0.0
9 15 ▶use Carp qw( croak );
Subroutine BEGIN: called CC=1 SCAR=0.0
10 15 ▶use Net::DHCPv6::Constants qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
11 $IPV6_ADDR_LEN $OPTION_UNICAST
12 15 );
13 15 ▶use Net::DHCPv6::X::Truncated ();
Subroutine BEGIN: called CC=1 SCAR=0.0
14 15 ▶use parent 'Net::DHCPv6::Option';
Subroutine BEGIN: called CC=1 SCAR=0.0
15 15 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 6 ▶sub new {
Subroutine new: called CC=3 SCAR=11.0
Pod documented
18 6 my ( $class, %args ) = @_;
19 6 my $addr = $class->_pick_addr( \%args, 'address' );
20 5 ▶ croak 'Unicast requires address'
Branch: 1 branch
BranchTrueFalseTotal
unless $addr and length $addr == $Net::DHCPv6::Option::Unicast::IPV6_ADDR_LEN 1 4 5
Condition66%2/3
$addr and length $addr == $Net::DHCPv6::Option::Unicast::IPV6_ADDR_LEN
!ll&&!rl&&r
104
MC/DC50%1/2
$addr and length $addr == $Net::DHCPv6::Option::Unicast::IPV6_ADDR_LEN
$addr length $addr == $Net::DHCPv6::Option::Unicast::IPV6_ADDR_LEN
Truth table66%2/3
A and B
A= $addrB= length $addr == $Net::DHCPv6::Option::Unicast::IPV6_ADDR_LEN
ABresult
0X0
100
111
21 unless $addr && CORE::length( $addr ) == $IPV6_ADDR_LEN;
22 4 $args{code} = $OPTION_UNICAST;
23 4 $args{data} = $addr;
24 4 my $self = $class->SUPER::new( %args );
25 4 $self->{address} = $addr;
26 4 return bless $self, $class;
27 }
28  
29 2 ▶sub address_raw { return shift->{address} }
Subroutine address_raw: called CC=1 SCAR=0.0
Pod documented
30  
31 2 ▶sub address {
Subroutine address: called CC=1 SCAR=0.0
Pod documented
32 2 my $self = shift;
33 2 return $self->_format_ipv6( $self->{address} );
34 }
35  
36 2 ▶sub from_bytes_inner {
Subroutine from_bytes_inner: called CC=2 SCAR=7.1
Pod documented
37 2 my ( $class, $code, $payload ) = @_;
38 2 ▶ Net::DHCPv6::X::Truncated->throw( message => 'Truncated Unicast option' )
Branch: 1 branch
BranchTrueFalseTotal
if length $payload < $Net::DHCPv6::Option::Unicast::IPV6_ADDR_LEN 0 2 2
39 if CORE::length( $payload ) < $IPV6_ADDR_LEN;
40 2 return $class->new( address_raw => substr( $payload, 0, $IPV6_ADDR_LEN ) );
41 }
42  
43 15 $Net::DHCPv6::OptionList::OPTION_CLASS{$OPTION_UNICAST} = __PACKAGE__;
44 15 1;
45  
46 __END__
« lib/Net/DHCPv6/Option/StatusCode.pm ↑ Summary lib/Net/DHCPv6/Option/ClientLinkLayerAddr.pm »