lib/Net/DHCPv6/Option/VendorOpts.pm

filter: Statementstmt 97.4% 38 / 39 Branchbran 66.6% 4 / 6 Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 100% 10 / 10 Podpod 100% 3 / 3 totaltotal 91.8% 56 / 61 CC 5 SCAR 7.1
CC
5
Cov
91%
new
4.1
from_bytes_inner
2.0
BEGIN
1.0
CRAP 2.0
« lib/Net/DHCPv6/Option/IAPD.pm ↑ Summary blib/lib/Net/DHCPv6/Constants.pm »
1 #!/usr/bin/false
2 # ABSTRACT: Vendor-specific Information option (code 17) — enterprise + sub-options
3 # PODNAME: Net::DHCPv6::Option::VendorOpts
4 package Net::DHCPv6::Option::VendorOpts;
5 15 $Net::DHCPv6::Option::VendorOpts::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 Ref::Util qw(is_plain_arrayref);
Subroutine BEGIN: called CC=1 SCAR=0.0
12 15 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 sub new {
15 3 ▶ my ( $class, %args ) = @_;
Subroutine new: called CC=4 SCAR=14.1
Pod documented
16 3 ▶ croak 'VendorOpts requires enterprise_number' unless defined $args{enterprise_number};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $args{"enterprise_number"} 1 2 3
17 2 $args{code} = $OPTION_VENDOR_OPTS;
18 2 ▶ my $sub_data = $args{sub_options} // '';
Condition50%1/2
$args{"sub_options"} // ""
l!l
20
MC/DC0%0/1
$args{"sub_options"} // ""
$args{"sub_options"}
Truth table50%1/2
A
A= $args{"sub_options"}
Aresult
11
00
19 2 ▶ $sub_data = join( '', map { $_->as_bytes } @$sub_data ) if is_plain_arrayref( $sub_data );
Branch: 1 branch
BranchTrueFalseTotal
if Ref::Util::XS::is_plain_arrayref($sub_data) 0 2 2
20 2 $args{data} = pack( 'N', $args{enterprise_number} ) . $sub_data;
21 2 my $self = $class->SUPER::new( %args );
22 2 $self->{enterprise_number} = $args{enterprise_number};
23 2 bless $self, $class;
24 }
25  
26 2 ▶sub enterprise_number { shift->{enterprise_number} }
Subroutine enterprise_number: 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 VendorOpts 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 return $class->new( enterprise_number => $en, sub_options => substr( $data, 4 ) );
34 }
35  
36 15 $Net::DHCPv6::OptionList::OPTION_CLASS{$OPTION_VENDOR_OPTS} = __PACKAGE__;
37 15 1;
38  
39 __END__
« lib/Net/DHCPv6/Option/IAPD.pm ↑ Summary blib/lib/Net/DHCPv6/Constants.pm »