Perl/Processor.pm

filter: Statementstmt 100% 22 / 22 Branchbran 66.6% 8 / 12 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 3 / 3 Podpod 0.0% 0 / 2 totaltotal 84.6% 33 / 39 CC 7 SCAR 13.1
CC
7
Cov
88%
open
4.0
close
4.0
BEGIN
1.0
CRAP 3.7
« Perl/Base.pm ↑ Summary Perl/Loader.pm »
1 package YAML::Perl::Processor;
2 18 ▶use YAML::Perl::Base -base;
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 18 field 'opened' => 0;
5 18 field 'closed' => 0;
6  
7 # Every class in the stack should have an open and close method.
8 # They should only allow an object to be opened once.
9 308 ▶sub open {
Subroutine open: called CC=4 SCAR=14.0
Pod undocumented
10 308 my $self = shift;
11 308 my $class = ref($self);
12 308 ▶ throw "Can't open an already opened $class object"
Branch: 1 branch
BranchTrueFalseTotal
if $self->opened 0 308 308
13 if $self->opened;
14 308 ▶ throw "Can't open an already closed $class object"
Branch: 1 branch
BranchTrueFalseTotal
if $self->closed 0 308 308
15 if $self->closed;
16 308 my $next_layer = $self->next_layer;
17 308 ▶ $self->$next_layer->open(@_)
Branch: 1 branch
BranchTrueFalseTotal
if $next_layer 238 70 308
18 if $next_layer;
19 308 $self->opened(1);
20 308 return $self;
21 }
22  
23 43 ▶sub close {
Subroutine close: called CC=4 SCAR=14.0
Pod undocumented
24 43 my $self = shift;
25 43 my $class = ref($self);
26 43 ▶ throw "Can't close an unopened $class object"
Branch: 1 branch
BranchTrueFalseTotal
unless $self->opened 0 43 43
27 unless $self->opened;
28 43 ▶ throw "Can't close an already closed $class object"
Branch: 1 branch
BranchTrueFalseTotal
if $self->closed 0 43 43
29 if $self->closed;
30 43 my $next_layer = $self->next_layer;
31 43 ▶ $self->$next_layer->close(@_)
Branch: 1 branch
BranchTrueFalseTotal
if $next_layer 32 11 43
32 if $next_layer;
33 43 $self->closed(1);
34 43 return 1;
35 }
36  
37 18 1;
« Perl/Base.pm ↑ Summary Perl/Loader.pm »