LLTD/Emit.pm

filter: Statementstmt 60.3% 32 / 53 Branchbran 37.5% 3 / 8 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 63.6% 7 / 11 Podpod 100% 7 / 7 totaltotal 59.5% 50 / 84 SCAR 27.6
CC
9
Cov
56%
unpack
7.3
getEmiteeDescLength
6.0
getLength
6.0
CRAP 15.8
« LLTD/QueryResp.pm ↑ Summary LLTD/Hello.pm »
1 #
2 # $Id: Emit.pm,v 1.2 2007/03/15 18:23:11 gomor Exp $
3 #
4 package Net::Frame::Layer::LLTD::Emit;
5 10 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 10 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 10 ▶use Net::Frame::Layer qw(:consts);
Subroutine BEGIN: called CC=1 SCAR=0.0
9 10 require Exporter;
10 10 our @ISA = qw(Net::Frame::Layer Exporter);
11  
12 10 our @AS = qw(
13 numDescs
14 );
15 10 our @AA = qw(
16 emiteeDescList
17 );
18 10 __PACKAGE__->cgBuildIndices;
19 10 __PACKAGE__->cgBuildAccessorsScalar(\@AS);
20 10 __PACKAGE__->cgBuildAccessorsArray (\@AA);
21  
22 10 ▶use Net::Frame::Layer::LLTD::EmiteeDesc;
Subroutine BEGIN: called CC=1 SCAR=0.0
23  
24 sub new {
25 shift->SUPER::new(
26 1 ▶ numDescs => 0,
Subroutine new: called CC=1 SCAR=0.0
Pod documented
27 emiteeDescList => [],
28 @_,
29 );
30 }
31  
32 sub getEmiteeDescLength {
33 0 ▶ my $self = shift;
Subroutine getEmiteeDescLength: not called CC=2 SCAR=17.9
Pod documented
34 0 my $len = 0;
35 0 for ($self->emiteeDescList) {
36 0 $len += $_->getLength;
37 }
38 0 $len;
39 }
40  
41 sub getLength {
42 0 ▶ my $self = shift;
Subroutine getLength: not called CC=2 SCAR=17.9
Pod documented
43 0 my $len = 2;
44 0 ▶ $len += $self->getEmiteeDescLength if $self->emiteeDescList;
Branch: 1 branch
BranchTrueFalseTotal
if $self->emiteeDescList 0 0 0
45 0 $len;
46 }
47  
48 sub pack {
49 1 ▶ my $self = shift;
Subroutine pack: called CC=2 SCAR=7.1
Pod documented
50  
51 1 ▶ $self->raw(
Branch: 1 branch
BranchTrueFalseTotal
$self->raw($self->SUPER::pack("n", $self->numDescs)) or return undef 0 1 1
52 $self->SUPER::pack('n',
53 $self->numDescs,
54 )
55 ) or return undef;
56  
57 1 $self->raw;
58 }
59  
60 sub unpack {
61 1 ▶ my $self = shift;
Subroutine unpack: called CC=5 SCAR=19.8
Pod documented
62  
63 1 ▶ my ($numDescs, $payload) =
Branch: 1 branch
BranchTrueFalseTotal
() = $self->SUPER::unpack("n a*", $self->raw) or return undef 0 1 1
64 $self->SUPER::unpack('n a*', $self->raw)
65 or return undef;
66  
67 1 $self->numDescs($numDescs);
68  
69 1 my @emiteeDescList = ();
70 1 ▶ if ($self->numDescs && $self->numDescs > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->numDescs and $self->numDescs > 0) 0 1 1
Condition33%1/3
$self->numDescs and $self->numDescs > 0
!ll&&!rl&&r
100
MC/DC0%0/2
$self->numDescs and $self->numDescs > 0
$self->numDescs $self->numDescs > 0
Truth table33%1/3
A and B
A= $self->numDescsB= $self->numDescs > 0
ABresult
0X0
100
111
71 0 for (1..$self->numDescs) {
72 0 my $emitee = Net::Frame::Layer::LLTD::EmiteeDesc->new(raw => $payload);
73 0 $emitee->unpack;
74 0 push @emiteeDescList, $emitee;
75 0 $payload = $emitee->payload;
76 }
77 }
78  
79 1 $self->emiteeDescList(\@emiteeDescList);
80 1 $self->payload($payload);
81  
82 1 $self;
83 }
84  
85 0 ▶sub encapsulate { shift->nextLayer }
Subroutine encapsulate: not called CC=1 SCAR=6.9
Pod documented
86  
87 sub print {
88 0 ▶ my $self = shift;
Subroutine print: not called CC=2 SCAR=17.9
Pod documented
89  
90 0 my $l = $self->layer;
91 0 my $buf = sprintf "$l: numDescs:%d", $self->numDescs;
92  
93 0 for ($self->emiteeDescList) {
94 0 $buf .= "\n".$_->print;
95 }
96  
97 0 $buf;
98 }
99  
100 10 1;
101  
102 __END__
« LLTD/QueryResp.pm ↑ Summary LLTD/Hello.pm »