lib/Net/DHCPv6/Option/RemoteId.pm

filter: Statementstmt 100% 37 / 37 Branchbran 83.3% 5 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 10 / 10 Podpod 100% 4 / 4 totaltotal 98.2% 56 / 57 CC 4 SCAR 4.8
CC
4
Cov
98%
new
3.0
from_bytes_inner
2.0
BEGIN
1.0
CRAP 1.6
« lib/Net/DHCPv6/Option/ClientLinkLayerAddr.pm ↑ Summary lib/Net/DHCPv6/Option/StatusCode.pm »
1 #!/usr/bin/false
2 # ABSTRACT: Remote ID option (code 37) — enterprise-number + opaque data
3 # PODNAME: Net::DHCPv6::Option::RemoteId
4 package Net::DHCPv6::Option::RemoteId;
5 15 $Net::DHCPv6::Option::RemoteId::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 4 ▶ my ( $class, %args ) = @_;
Subroutine new: called CC=3 SCAR=11.0
Pod documented
15 4 ▶ croak 'RemoteId requires enterprise_number' unless defined $args{enterprise_number};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $args{"enterprise_number"} 1 3 4
16 3 ▶ croak 'RemoteId requires remote_data' unless defined $args{remote_data};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $args{"remote_data"} 1 2 3
17 2 $args{code} = $OPTION_REMOTE_ID;
18 2 $args{data} = pack( 'N', $args{enterprise_number} ) . $args{remote_data};
19 2 my $self = $class->SUPER::new( %args );
20 2 $self->{enterprise_number} = $args{enterprise_number};
21 2 $self->{remote_data} = $args{remote_data};
22 2 bless $self, $class;
23 }
24  
25 2 ▶sub enterprise_number { shift->{enterprise_number} }
Subroutine enterprise_number: called CC=1 SCAR=0.0
Pod documented
26 2 ▶sub remote_data { shift->{remote_data} }
Subroutine remote_data: called CC=1 SCAR=0.0
Pod documented
27  
28 sub from_bytes_inner {
29 1 ▶ my ( $class, $code, $data ) = @_;
Subroutine from_bytes_inner: called CC=2 SCAR=7.0
Pod documented
30 1 ▶ Net::DHCPv6::X::Truncated->throw( message => 'Truncated RemoteId option' )
Branch: 1 branch
BranchTrueFalseTotal
if length $data < 4 0 1 1
31 if CORE::length( $data ) < 4;
32 1 my $en = unpack( 'N', substr( $data, 0, 4 ) );
33 1 my $rest = substr( $data, 4 );
34 1 return $class->new( enterprise_number => $en, remote_data => $rest );
35 }
36  
37 15 $Net::DHCPv6::OptionList::OPTION_CLASS{$OPTION_REMOTE_ID} = __PACKAGE__;
38 15 1;
39  
40 __END__
« lib/Net/DHCPv6/Option/ClientLinkLayerAddr.pm ↑ Summary lib/Net/DHCPv6/Option/StatusCode.pm »