blib/lib/Net/Frame/Layer/LOOP.pm

filter: Statementstmt 87.8% 36 / 41 Branchbran 50.0% 2 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 72.7% 8 / 11 Podpod 100% 6 / 6 totaltotal 83.8% 52 / 62 SCAR 11.1
CC
3
Cov
84%
pack
2.0
unpack
2.0
getLength
2.0
CRAP 3.0
↑ Summary
1 #
2 # $Id: LOOP.pm,v 1.1 2007/03/31 10:34:41 gomor Exp $
3 #
4 package Net::Frame::Layer::LOOP;
5 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 3 our $VERSION = '1.00';
9  
10 3 ▶use Net::Frame::Layer qw(:consts);
Subroutine BEGIN: called CC=1 SCAR=0.0
11 3 require Exporter;
12 3 our @ISA = qw(Net::Frame::Layer Exporter);
13  
14 3 our %EXPORT_TAGS = (
15 consts => [qw(
16 NF_LOOP_HDR_LEN
17 NF_LOOP_FUNCTION_REPLY
18 )],
19 );
20 our @EXPORT_OK = (
21 3 @{$EXPORT_TAGS{consts}},
22 );
23  
24 3 ▶use constant NF_LOOP_HDR_LEN => 6;
Subroutine BEGIN: called CC=1 SCAR=0.0
25 3 ▶use constant NF_LOOP_FUNCTION_REPLY => 0x0100;
Subroutine BEGIN: called CC=1 SCAR=0.0
26  
27 3 our @AS = qw(
28 skipCount
29 function
30 receiptNumber
31 );
32 3 __PACKAGE__->cgBuildIndices;
33 3 __PACKAGE__->cgBuildAccessorsScalar(\@AS);
34  
35 sub new {
36 shift->SUPER::new(
37 1 ▶ skipCount => 0,
Subroutine new: called CC=1 SCAR=0.0
Pod documented
38 function => NF_LOOP_FUNCTION_REPLY,
39 receiptNumber => 0,
40 @_,
41 );
42 }
43  
44 0 ▶sub getLength { NF_LOOP_HDR_LEN }
Subroutine getLength: not called CC=1 SCAR=6.9
Pod documented
45  
46 sub pack {
47 1 ▶ my $self = shift;
Subroutine pack: called CC=2 SCAR=7.1
Pod documented
48  
49 1 ▶ $self->raw($self->SUPER::pack('nnn',
Branch: 1 branch
BranchTrueFalseTotal
$self->raw($self->SUPER::pack("nnn", $self->skipCount, $self->function, $self->receiptNumber)) or return undef 0 1 1
50 $self->skipCount,
51 $self->function,
52 $self->receiptNumber,
53 )) or return undef;
54  
55 1 $self->raw;
56 }
57  
58 sub unpack {
59 1 ▶ my $self = shift;
Subroutine unpack: called CC=2 SCAR=7.0
Pod documented
60  
61 1 ▶ my ($skipCount, $function, $receiptNumber, $payload) =
Branch: 1 branch
BranchTrueFalseTotal
() = $self->SUPER::unpack("nnn a*", $self->raw) or return undef 0 1 1
62 $self->SUPER::unpack('nnn a*', $self->raw)
63 or return undef;
64  
65 1 $self->skipCount($skipCount);
66 1 $self->function($function);
67 1 $self->receiptNumber($receiptNumber);
68  
69 1 $self->payload($payload);
70  
71 1 $self;
72 }
73  
74 0 ▶sub encapsulate { shift->nextLayer }
Subroutine encapsulate: not called CC=1 SCAR=6.9
Pod documented
75  
76 sub print {
77 0 ▶ my $self = shift;
Subroutine print: not called CC=1 SCAR=6.9
Pod documented
78  
79 0 my $l = $self->layer;
80 0 sprintf "$l: skipCount:%d function:0x%04x receiptNumber:%d",
81 $self->skipCount,
82 $self->function,
83 $self->receiptNumber,
84 ;
85 }
86  
87 3 1;
88  
89 __END__
↑ Summary