lib/Net/DHCPv6/Option/RemoteId.pm

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