| 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
| |||||||||||||||||||||
| 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
| |||||||||||||||||||||
| 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
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
| |||||||||||||||||||||
| 30 | } | ||||||||||||||||||||
| 31 | |||||||||||||||||||||
| 32 | ###################################################################### | ||||||||||||||||||||
| 33 | |||||||||||||||||||||
| 34 | 2 | 1; | |||||||||||||||||||
| 35 | |||||||||||||||||||||
| 36 | __END__ | ||||||||||||||||||||