lib/Net/DHCPv6/Option/VendorOpts.pm

filter: Statementstmt 95.5% 43 / 45 Branchbran 66.6% 4 / 6 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 11 / 11 Podpod 100% 3 / 3 totaltotal 88.5% 62 / 70 CC 5 SCAR 7.1
CC
5
Cov
89%
new
4.3
from_bytes_inner
2.0
BEGIN
1.0
CRAP 2.0
« lib/Net/DHCPv6/Option/IAPD.pm ↑ Summary lib/Net/DHCPv6/Option/BootfileParam.pm »
1 #!/bin/false
2 # ABSTRACT: Vendor-specific Information option (code 17) -- enterprise + sub-options
3 # PODNAME: Net::DHCPv6::Option::VendorOpts
4 15 ▶use strictures 2;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 package Net::DHCPv6::Option::VendorOpts;
7 15 $Net::DHCPv6::Option::VendorOpts::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_VENDOR_OPTS
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 Ref::Util qw( is_plain_arrayref );
Subroutine BEGIN: called CC=1 SCAR=0.0
16 15 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 15 my $EMPTY = q();
18 15 my $ENT_NUM_LEN = 4; ## no critic (ValuesAndExpressions::ProhibitMagicNumbers)
19  
20 3 ▶sub new {
Subroutine new: called CC=4 SCAR=14.7
Pod documented
21 3 my ( $class, %args ) = @_;
22 3 ▶ croak 'VendorOpts requires enterprise_number' unless defined $args{enterprise_number};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $args{"enterprise_number"} 1 2 3
23 2 $args{code} = $OPTION_VENDOR_OPTS;
24 2 ▶ my $sub_data = $args{sub_options} // $EMPTY;
Condition33%1/3
$args{"sub_options"} // $EMPTY
l!l&&r!l&&!r
200
MC/DC0%0/2
$args{"sub_options"} // $EMPTY
$args{"sub_options"} $EMPTY
Truth table33%1/3
A // B
A= $args{"sub_options"}B= $EMPTY
ABresult
1X1
011
000
25 0 ▶ $sub_data = join( $EMPTY, 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
26 2 $args{data} = pack( 'N', $args{enterprise_number} ) . $sub_data;
27 2 my $self = $class->SUPER::new( %args );
28 2 $self->{enterprise_number} = $args{enterprise_number};
29 2 return bless $self, $class;
30 }
31  
32 2 ▶sub enterprise_number { return shift->{enterprise_number} }
Subroutine enterprise_number: called CC=1 SCAR=0.0
Pod documented
33  
34 1 ▶sub from_bytes_inner {
Subroutine from_bytes_inner: called CC=2 SCAR=7.0
Pod documented
35 1 my ( $class, $code, $payload ) = @_;
36 1 ▶ Net::DHCPv6::X::Truncated->throw( message => 'Truncated VendorOpts option' )
Branch: 1 branch
BranchTrueFalseTotal
if length $payload < $ENT_NUM_LEN 0 1 1
37 if CORE::length( $payload ) < $ENT_NUM_LEN;
38 1 my $en = unpack( 'N', substr( $payload, 0, $ENT_NUM_LEN ) );
39 1 return $class->new( enterprise_number => $en, sub_options => substr( $payload, $ENT_NUM_LEN ) );
40 }
41  
42 15 $Net::DHCPv6::OptionList::OPTION_CLASS{$OPTION_VENDOR_OPTS} = __PACKAGE__;
43 15 1;
44  
45 __END__
« lib/Net/DHCPv6/Option/IAPD.pm ↑ Summary lib/Net/DHCPv6/Option/BootfileParam.pm »