lib/Net/DHCPv6/Option/BootfileParam.pm

filter: Statementstmt 100% 47 / 47 Branchbran 66.6% 4 / 6 Conditioncond 100% 2 / 2 MC/DCmcdc 100% 1 / 1 Subroutinesub 100% 10 / 10 Podpod 100% 3 / 3 totaltotal 97.1% 67 / 69 CC 5 SCAR 6.2
CC
5
Cov
96%
new
3.0
from_bytes_inner
3.0
BEGIN
1.0
CRAP 1.9
« lib/Net/DHCPv6/Option/VendorOpts.pm ↑ Summary lib/Net/DHCPv6/Option/UserClass.pm »
1 #!/bin/false
2 # ABSTRACT: Boot File Parameters option (code 60) -- list of boot parameters
3 # PODNAME: Net::DHCPv6::Option::BootfileParam
4 15 ▶use strictures 2;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 package Net::DHCPv6::Option::BootfileParam;
7 15 $Net::DHCPv6::Option::BootfileParam::VERSION = '0.003';
8 15 ▶use Net::DHCPv6::OptionList ();
Subroutine BEGIN: called CC=1 SCAR=0.0
9 15 ▶use Net::DHCPv6::Constants qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
10 $OPTION_BOOTFILE_PARAM
11 15 );
12 15 ▶use Net::DHCPv6::X::Truncated ();
Subroutine BEGIN: called CC=1 SCAR=0.0
13 15 ▶use parent 'Net::DHCPv6::Option';
Subroutine BEGIN: called CC=1 SCAR=0.0
14 15 ▶use Ref::Util qw( is_plain_arrayref );
Subroutine BEGIN: called CC=1 SCAR=0.0
15 15 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 15 my $EMPTY = q();
17  
18 3 ▶sub new {
Subroutine new: called CC=3 SCAR=11.0
Pod documented
19 3 my ( $class, %args ) = @_;
20 3 $args{code} = $OPTION_BOOTFILE_PARAM;
21 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
22 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
23 3 $args{data} = join( $EMPTY, map { pack( 'n', CORE::length ) . $_ } @{$data_list} );
24 3 my $self = $class->SUPER::new( %args );
25 3 $self->{parameters} = $data_list;
26 3 return bless $self, $class;
27 }
28  
29 3 ▶sub parameters { return shift->{parameters} }
Subroutine parameters: called CC=1 SCAR=0.0
Pod documented
30  
31 1 ▶sub from_bytes_inner {
Subroutine from_bytes_inner: called CC=3 SCAR=11.0
Pod documented
32 1 my ( $class, $code, $payload ) = @_;
33 1 my @items;
34 1 my $offset = 0;
35 1 my $len = CORE::length( $payload );
36 1 ▶ while ( $offset + 2 <= $len ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($offset + 2 <= $len) 2 1 3
37 2 my $ilen = unpack( 'n', substr( $payload, $offset, 2 ) );
38 2 $offset += 2;
39 2 ▶ Net::DHCPv6::X::Truncated->throw( message => 'Truncated BootfileParam item' )
Branch: 1 branch
BranchTrueFalseTotal
if $offset + $ilen > $len 0 2 2
40 if $offset + $ilen > $len;
41 2 push @items, substr( $payload, $offset, $ilen );
42 2 $offset += $ilen;
43 }
44 1 return $class->new( parameters => \@items );
45 }
46  
47 15 $Net::DHCPv6::OptionList::OPTION_CLASS{$OPTION_BOOTFILE_PARAM} = __PACKAGE__;
48 15 1;
49  
50 __END__
« lib/Net/DHCPv6/Option/VendorOpts.pm ↑ Summary lib/Net/DHCPv6/Option/UserClass.pm »