lib/Net/DHCPv6/Option/ClientLinkLayerAddr.pm

filter: Statementstmt 100% 40 / 40 Branchbran 83.3% 5 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 11 / 11 Podpod 100% 4 / 4 totaltotal 98.3% 60 / 61 CC 4 SCAR 4.5
CC
4
Cov
98%
new
3.0
from_bytes_inner
2.0
BEGIN
1.0
CRAP 1.6
« lib/Net/DHCPv6/Option/Unicast.pm ↑ Summary lib/Net/DHCPv6/Option/RemoteId.pm »
1 #!/bin/false
2 # ABSTRACT: Client Link-Layer Address option (code 79) -- link-layer type + address
3 # PODNAME: Net::DHCPv6::Option::ClientLinkLayerAddr
4 15 ▶use strictures 2;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 package Net::DHCPv6::Option::ClientLinkLayerAddr;
7 15 $Net::DHCPv6::Option::ClientLinkLayerAddr::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 $OPTION_CLIENT_LINKLAYER_ADDR
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 3 ▶sub new {
Subroutine new: called CC=3 SCAR=11.0
Pod documented
18 3 my ( $class, %args ) = @_;
19 3 ▶ croak 'ClientLinkLayerAddr requires link_layer_type' unless defined $args{link_layer_type};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $args{"link_layer_type"} 0 3 3
20 3 ▶ croak 'ClientLinkLayerAddr requires link_layer_addr' unless defined $args{link_layer_addr};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $args{"link_layer_addr"} 1 2 3
21 2 $args{code} = $OPTION_CLIENT_LINKLAYER_ADDR;
22 2 $args{data} = pack( 'n', $args{link_layer_type} ) . $args{link_layer_addr};
23 2 my $self = $class->SUPER::new( %args );
24 2 $self->{link_layer_type} = $args{link_layer_type};
25 2 $self->{link_layer_addr} = $args{link_layer_addr};
26 2 return bless $self, $class;
27 }
28  
29 2 ▶sub link_layer_type { return shift->{link_layer_type} }
Subroutine link_layer_type: called CC=1 SCAR=0.0
Pod documented
30 2 ▶sub link_layer_addr { return shift->{link_layer_addr} }
Subroutine link_layer_addr: called CC=1 SCAR=0.0
Pod documented
31  
32 2 ▶sub from_bytes_inner {
Subroutine from_bytes_inner: called CC=2 SCAR=6.9
Pod documented
33 2 my ( $class, $code, $payload ) = @_;
34 2 ▶ Net::DHCPv6::X::Truncated->throw( message => 'Truncated ClientLinkLayerAddr option' )
Branch: 1 branch
BranchTrueFalseTotal
if length $payload < 3 1 1 2
35 if CORE::length( $payload ) < 3; ## no critic (ValuesAndExpressions::ProhibitMagicNumbers)
36 1 my $type = unpack( 'n', substr( $payload, 0, 2 ) );
37 1 my $addr = substr( $payload, 2 );
38 1 return $class->new( link_layer_type => $type, link_layer_addr => $addr );
39 }
40  
41 15 $Net::DHCPv6::OptionList::OPTION_CLASS{$OPTION_CLIENT_LINKLAYER_ADDR} = __PACKAGE__;
42 15 1;
43  
44 __END__
« lib/Net/DHCPv6/Option/Unicast.pm ↑ Summary lib/Net/DHCPv6/Option/RemoteId.pm »