lib/Net/DHCPv6/Option/BootfileParam.pm

filter: Statementstmt 100% 45 / 45 Branchbran 66.6% 4 / 6 Conditioncond 100% 2 / 2 MC/DCmcdc 100% 1 / 1 Subroutinesub 100% 10 / 10 Podpod 100% 3 / 3 totaltotal 97.0% 65 / 67 CC 5 SCAR 6.2
CC
5
Cov
96%
new
3.0
from_bytes_inner
3.0
BEGIN
1.0
CRAP 1.9
« blib/lib/Net/DHCPv6/X/Truncated.pm ↑ Summary lib/Net/DHCPv6/Option/UserClass.pm »
1 #!/usr/bin/false
2 # ABSTRACT: Boot File Parameters option (code 60) — list of boot parameters
3 # PODNAME: Net::DHCPv6::Option::BootfileParam
4 package Net::DHCPv6::Option::BootfileParam;
5 15 $Net::DHCPv6::Option::BootfileParam::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=3 SCAR=11.0
Pod documented
16 3 $args{code} = $OPTION_BOOTFILE_PARAM;
17 3 ▶ my $data_list = $args{parameters} // [];
Condition100%2/2
$args{"parameters"} // []
l!l
21
MC/DC100%1/1
$args{"parameters"} // []
$args{"parameters"}
Truth table100%2/2
A
A= $args{"parameters"}
Aresult
11
00
18 3 ▶ $data_list = [$data_list] unless is_plain_arrayref( $data_list );
Branch: 1 branch
BranchTrueFalseTotal
unless Ref::Util::XS::is_plain_arrayref($data_list) 0 3 3
19 3 $args{data} = join( '', map { pack( 'n', CORE::length ) . $_ } @$data_list );
20 3 my $self = $class->SUPER::new( %args );
21 3 $self->{parameters} = $data_list;
22 3 bless $self, $class;
23 }
24  
25 3 ▶sub parameters { shift->{parameters} }
Subroutine parameters: called CC=1 SCAR=0.0
Pod documented
26  
27 sub from_bytes_inner {
28 1 ▶ my ( $class, $code, $data ) = @_;
Subroutine from_bytes_inner: called CC=3 SCAR=11.0
Pod documented
29 1 my @items;
30 1 my $offset = 0;
31 1 my $len = CORE::length( $data );
32 1 ▶ while ( $offset + 2 <= $len ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($offset + 2 <= $len) 2 1 3
33 2 my $ilen = unpack( 'n', substr( $data, $offset, 2 ) );
34 2 $offset += 2;
35 2 ▶ Net::DHCPv6::X::Truncated->throw( message => 'Truncated BootfileParam item' )
Branch: 1 branch
BranchTrueFalseTotal
if $offset + $ilen > $len 0 2 2
36 if $offset + $ilen > $len;
37 2 push @items, substr( $data, $offset, $ilen );
38 2 $offset += $ilen;
39 }
40 1 return $class->new( parameters => \@items );
41 }
42  
43 15 $Net::DHCPv6::OptionList::OPTION_CLASS{$OPTION_BOOTFILE_PARAM} = __PACKAGE__;
44 15 1;
45  
46 __END__
« blib/lib/Net/DHCPv6/X/Truncated.pm ↑ Summary lib/Net/DHCPv6/Option/UserClass.pm »