| 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"} // []
MC/DC100%1/1
$args{"parameters"} // []
$args{"parameters"}
Truth table100%2/2
A
A= $args{"parameters"}
| |||||||||||||
| 22 | 3 | ▶ | $data_list = [$data_list] unless is_plain_arrayref( $data_list ); | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 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
| |||||||||||||
| 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
| |||||||||||||
| 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__ | ||||||||||||