blib/lib/Text/MicroMason/PostProcess.pm

filter: Statementstmt 96.3% 26 / 27 Branchbran 90.0% 9 / 10 Conditioncond 50.0% 3 / 6 MC/DCmcdc 25.0% 1 / 4 Subroutinesub 100% 5 / 5 Podpod 66.6% 2 / 3 totaltotal 83.6% 46 / 55 CC 9 SCAR 14.8
CC
9
Cov
88%
post_processors
6.3
post_process
4.0
BEGIN
1.0
CRAP 4.4
« blib/lib/Text/MicroMason/ServerPages.pm ↑ Summary blib/lib/Text/MicroMason/HTMLMason.pm »
1 package Text::MicroMason::PostProcess;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 ######################################################################
7  
8 10 ▶sub assembler_rules {
Subroutine assembler_rules: called CC=1 SCAR=0.0
Pod undocumented
9 10 my $self = shift;
10 10 my %rules = $self->NEXT('assembler_rules', @_);
11 10 $rules{return_output} = "\$m->post_process( $rules{return_output} )";
12 10 %rules;
13 }
14  
15 14 ▶sub post_processors {
Subroutine post_processors: called CC=6 SCAR=18.5
Pod documented
16 14 my $self = shift;
17 14 my $funcs = $self->{post_process};
18 14 ▶ my @funcs = ref($funcs) eq 'ARRAY' ? @$funcs : $funcs ? $funcs : ();
Branch: 2 branches
BranchTrueFalseTotal
ref $funcs eq 'ARRAY' ? : 6 8 14
$funcs ? : 5 3 8
19 14 ▶ if ( scalar @_ ) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @_) 4 10 14
20 0 ▶ @funcs = ( $#_ == 0 and ref($_[0]) eq 'ARRAY' ) ? @{ $_[0] } : (@funcs, @_);
Branch: 1 branch
BranchTrueFalseTotal
$#_ == 0 && ref $_[0] eq 'ARRAY' ? : 0 4 4
Condition33%1/3
$#_ == 0 and ref $_[0] eq "ARRAY"
!ll&&!rl&&r
040
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "ARRAY"
$#_ == 0 ref $_[0] eq "ARRAY"
Truth table33%1/3
A and B
A= $#_ == 0B= ref $_[0] eq "ARRAY"
ABresult
0X0
100
111
21 4 $self->{post_process} = [ @funcs ];
22 }
23 14 return @funcs;
24 }
25  
26 10 ▶sub post_process {
Subroutine post_process: called CC=4 SCAR=13.9
Pod documented
27 10 my $self = shift;
28 10 local $_ = shift;
29 10 foreach my $func ( $self->post_processors ) {
30 13 my $p = prototype($func);
31 13 ▶ if ( defined $p and ! length $p ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $p and not length $p) { } 2 11 13
Condition66%2/3
defined $p and not length $p
!ll&&!rl&&r
1102
MC/DC50%1/2
defined $p and not length $p
defined $p not length $p
Truth table66%2/3
A and not(B)
A= defined $pB= not length $p
ABresult
0X0
100
111
32 2 &$func;
33 } else {
34 11 $_ = &$func( $_ );
35 }
36 }
37 10 $_;
38 }
39  
40 ######################################################################
41  
42 1 1;
43  
44 __END__
« blib/lib/Text/MicroMason/ServerPages.pm ↑ Summary blib/lib/Text/MicroMason/HTMLMason.pm »