| 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
| |||||||||||||||||||||||||||||
| 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
Condition0%0/3
not $content and $self->_post_processor
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
| |||||||||||||||||||||||||||||
| 30 | 0 | $content = $processor; | |||||||||||||||||||||||||||
| 31 | 0 | $processor = $self->_post_processor | |||||||||||||||||||||||||||
| 32 | } | ||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | 0 | ▶ | $content //= ''; | ||||||||||||||||||||||||||
|
Condition0%0/2
$content //= ""
MC/DC0%0/1
$content //= ""
$content
Truth table0%0/2
A
A= $content
| |||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | 0 | ▶ | my $class = $processor =~ /\:\:/ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | 0 | ▶ | my $content_ref = ref $content ? $content : \$content; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | 0 | $class->process($content_ref) | |||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | 2 | 1; | |||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | __END__ | ||||||||||||||||||||||||||||