blib/lib/Net/DHCP/Packet/OrderOptions.pm

filter: Statementstmt 100% 26 / 26 Branchbran 100% 10 / 10 Conditioncond 100% 6 / 6 MC/DCmcdc 100% 3 / 3 Subroutinesub 100% 5 / 5 Podpod 100% 1 / 1 totaltotal 100% 51 / 51 CC 8 SCAR 17.3
CC
8
Cov
100%
reorder_options
8.0
BEGIN
1.0
BEGIN
1.0
CRAP 5.7
« blib/lib/Net/DHCP/Packet.pm ↑ Summary Build »
1 #!/bin/false
2 # PODNAME: Net::DHCP::Packet::OrderOptions
3 # ABSTRACT: Option ordering quirks for Net::DHCP
4 14 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 14 ▶use warnings FATAL => 'uninitialized';
Subroutine BEGIN: called CC=1 SCAR=0.0
6 14 ▶use 5.8.0;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 package Net::DHCP::Packet::OrderOptions;
9 14 $Net::DHCP::Packet::OrderOptions::VERSION = '0.8';
10 14 ▶use Exporter 'import';
Subroutine BEGIN: called CC=1 SCAR=0.0
11 14 our @EXPORT_OK = qw( reorder_options );
12 14 our %EXPORT_TAGS = ( all => \@EXPORT_OK );
13  
14 #=======================================================================
15 sub reorder_options {
16 19 ▶ my @codes = @_;
Subroutine reorder_options: called CC=8 SCAR=20.8
Pod documented
17  
18 # Quirk: Intel PXE wants option 60 before option 43
19 19 my ( $i60, $i43 );
20 19 ▶ for ( my $i = 0; $i < @codes; $i++ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < @codes) 36 19 55
21 36 ▶ $i60 = $i if $codes[$i] == 60;
Branch: 1 branch
BranchTrueFalseTotal
if $codes[$i] == 60 7 29 36
22 36 ▶ $i43 = $i if $codes[$i] == 43;
Branch: 1 branch
BranchTrueFalseTotal
if $codes[$i] == 43 6 30 36
23 }
24 19 ▶ if ( defined $i60 && defined $i43 && $i60 > $i43 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $i60 and defined $i43 and $i60 > $i43) 2 17 19
Condition100%6/6
defined $i60 and defined $i43 and $i60 > $i43
!ll&&!rl&&r
1432
defined $i60 and defined $i43
!ll&&!rl&&r
1315
MC/DC100%3/3
defined $i60 and defined $i43 and $i60 > $i43
defined $i60 defined $i43 $i60 > $i43
Truth table100%4/4
A and B and C
A= defined $i60B= defined $i43C= $i60 > $i43
ABCresult
0XX0
10X0
1100
1111
25 2 @codes[ $i60, $i43 ] = @codes[ $i43, $i60 ];
26 }
27  
28 # Quirk: Cablelabs want option 82 at the very end
29 19 my @no82 = grep { $_ != 82 } @codes;
30 19 ▶ @codes = ( @no82, 82 ) if @no82 != @codes;
Branch: 1 branch
BranchTrueFalseTotal
if @no82 != @codes 5 14 19
31  
32 return @codes
33 19 }
34  
35 #=======================================================================
36  
37 14 1;
38  
39 __END__
« blib/lib/Net/DHCP/Packet.pm ↑ Summary Build »