blib/lib/Text/MicroMason/ExecuteCache.pm

filter: Statementstmt 100% 17 / 17 Branchbran 75.0% 3 / 4 Conditioncond 66.6% 2 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 5 / 5 Podpod 100% 1 / 1 totaltotal 87.5% 28 / 32 CC 4 SCAR 5.6
CC
4
Cov
92%
_execute_cache
2.0
compile
2.0
__ANON__
2.0
CRAP 1.8
« blib/lib/Text/MicroMason/QuickTemplate.pm ↑ Summary blib/lib/Text/MicroMason/DoubleQuote.pm »
1 package Text::MicroMason::ExecuteCache;
2  
3 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 2 require Text::MicroMason::Base;
7 2 require Text::MicroMason::Cache::Simple;
8  
9 ######################################################################
10  
11 # $code_ref = compile( text => $template );
12 23 ▶sub compile {
Subroutine compile: called CC=2 SCAR=7.0
Pod documented
13 23 my $self = shift;
14
15 23 my $code_ref = $self->NEXT('compile', @_);
16
17 23 ▶ my $cache = $self->_execute_cache()
Branch: 1 branch
BranchTrueFalseTotal
my $cache = $self->_execute_cache or return $code_ref 23 0 23
18 or return $code_ref;
19
20 163 ▶ sub {
Subroutine __ANON__: called CC=2 SCAR=6.9
21 163 my $key = join("|", $code_ref, @_);
22 163 ▶ $cache->get( $key ) or $cache->set( $key, $code_ref->( @_ ) );
Branch: 1 branch
BranchTrueFalseTotal
$cache->get($key) or $cache->set($key, &$code_ref(@_)) 26 137 163
23 }
24 23 }
25  
26 23 ▶sub _execute_cache {
Subroutine _execute_cache: called CC=2 SCAR=7.1
27 23 my $self = shift;
28
29 23 ▶ $self->{execute_cache} ||= Text::MicroMason::Cache::Simple->new();
Condition66%2/3
$self->{"execute_cache"} ||= "Text::MicroMason::Cache::Simple"->new
l!l&&r!l&&!r
1940
MC/DC0%0/2
$self->{"execute_cache"} ||= "Text::MicroMason::Cache::Simple"->new
$self->{"execute_cache"} "Text::MicroMason::Cache::Simple"->new
Truth table66%2/3
A ||= B
A= $self->{"execute_cache"}B= "Text::MicroMason::Cache::Simple"->new
ABresult
1X1
011
000
30 }
31  
32 ######################################################################
33  
34 2 1;
35  
36 __END__
« blib/lib/Text/MicroMason/QuickTemplate.pm ↑ Summary blib/lib/Text/MicroMason/DoubleQuote.pm »