lib/Rapi/Blog/Util/ppRender.pm

filter: Statementstmt 54.2% 19 / 35 Branchbran 0.0% 0 / 10 Conditioncond 0.0% 0 / 5 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 55.5% 5 / 9 Podpod n/a totaltotal 38.7% 24 / 62 CC 8 SCAR 36.0
CC
8
Cov
38%
_call_process
72.0
AUTOLOAD
2.0
__ANON__
1.1
CRAP 36.6
« lib/Rapi/Blog/Util.pm ↑ Summary lib/Rapi/Blog.pm »
1 package Rapi::Blog::Util::ppRender;
2 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 # ABSTRACT: Render method dispatch to template process class
6  
7 2 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 2 ▶use Types::Standard qw(:all);
Subroutine BEGIN: called CC=1 SCAR=0.0
9 2 ▶use RapidApp::Util qw(:all);
Subroutine BEGIN: called CC=1 SCAR=0.0
10 2 require Module::Runtime;
11  
12 0 ▶has '_base_namespace', is => 'ro', isa => Str, default => sub {'Rapi::Blog::Template::Postprocessor'};
Subroutine __ANON__: not called CC=1 SCAR=1.2
13  
14 0 ▶has '_post_processor', is => 'rw', isa => Maybe[Str], default => sub {undef};
Subroutine __ANON__: not called CC=1 SCAR=1.2
15  
16  
17 0 ▶sub AUTOLOAD {
Subroutine AUTOLOAD: not called CC=1 SCAR=6.9
18 0 my $self = shift;
19 0 my $method = (reverse(split('::',our $AUTOLOAD)))[0];
20 0 $self->_call_process($method,@_)
21 }
22  
23 0 ▶sub _call_process {
Subroutine _call_process: not called CC=8 SCAR=42.8
24 0 my ($self, $processor, $content) = @_;
25
26 0 ▶ die "ppRender: no Postprocessor and/or content supplied" unless ($processor);
Branch: 1 branch
BranchTrueFalseTotal
unless $processor 0 0 0
27
28 # Allow us to be called with or without the name of the post-processor
29 0 ▶ if(! $content && $self->_post_processor) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $content and $self->_post_processor) 0 0 0
Condition0%0/3
not $content and $self->_post_processor
!ll&&!rl&&r
000
MC/DC0%0/2
not $content and $self->_post_processor
not $content $self->_post_processor
Truth table0%0/3
not(A) and B
A= not $contentB= $self->_post_processor
ABresult
0X0
100
111
30 0 $content = $processor;
31 0 $processor = $self->_post_processor
32 }
33
34 0 ▶ $content //= '';
Condition0%0/2
$content //= ""
l!l
00
MC/DC0%0/1
$content //= ""
$content
Truth table0%0/2
A
A= $content
Aresult
11
00
35
36 0 ▶ my $class = $processor =~ /\:\:/
Branch: 1 branch
BranchTrueFalseTotal
$processor =~ /\:\:/ ? : 0 0 0
37 ? $processor
38 : join('::',$self->_base_namespace,$processor);
39
40 0 Module::Runtime::require_module($class);
41  
42 0 ▶ $class->can('process') or die "$class is not a Template Processor class without a ->process method";
Branch: 1 branch
BranchTrueFalseTotal
$class->can("process") or die "$class is not a Template Processor class without a ->process method" 0 0 0
43  
44 0 ▶ my $content_ref = ref $content ? $content : \$content;
Branch: 1 branch
BranchTrueFalseTotal
ref $content ? : 0 0 0
45  
46 0 $class->process($content_ref)
47 }
48  
49  
50  
51  
52 2 1;
53  
54  
55 __END__
« lib/Rapi/Blog/Util.pm ↑ Summary lib/Rapi/Blog.pm »