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.002';
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;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 15 ▶use Net::DHCPv6::X::Truncated;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 15 ▶use parent 'Net::DHCPv6::Option';
Subroutine BEGIN: called CC=1 SCAR=0.0
13 15 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 sub new {
16 6 ▶ my ( $class, %args ) = @_;
Subroutine new: called CC=3 SCAR=11.0
Pod documented
17 6 my $addr = $class->_pick_addr( \%args, 'address' );
18 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
19 unless $addr && CORE::length( $addr ) == $IPV6_ADDR_LEN;
20 4 $args{code} = $OPTION_UNICAST;
21 4 $args{data} = $addr;
22 4 my $self = $class->SUPER::new( %args );
23 4 $self->{address} = $addr;
24 4 return bless $self, $class;
25 }
26  
27 2 ▶sub address_raw { return shift->{address} }
Subroutine address_raw: called CC=1 SCAR=0.0
Pod documented
28  
29 sub address {
30 2 ▶ my $self = shift;
Subroutine address: called CC=1 SCAR=0.0
Pod documented
31 2 return $self->_format_ipv6( $self->{address} );
32 }
33  
34 sub from_bytes_inner {
35 2 ▶ my ( $class, $code, $payload ) = @_;
Subroutine from_bytes_inner: called CC=2 SCAR=7.1
Pod documented
36 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
37 if CORE::length( $payload ) < $IPV6_ADDR_LEN;
38 2 return $class->new( address_raw => substr( $payload, 0, $IPV6_ADDR_LEN ) );
39 }
40  
41 15 $Net::DHCPv6::OptionList::OPTION_CLASS{$OPTION_UNICAST} = __PACKAGE__;
42 15 1;
43  
44 __END__
« lib/Net/DHCPv6/Option/StatusCode.pm ↑ Summary lib/Net/DHCPv6/Option/ClientLinkLayerAddr.pm »