| 1 | package Mason::Plugin::Cache::Component; | ||||||||||||||||||||||||||||
| 2 | 1 | ▶ | BEGIN { | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | 1 | $Mason::Plugin::Cache::Component::VERSION = '0.05'; | |||||||||||||||||||||||||||
| 4 | } | ||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use Mason::PluginRole; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 1 | my %memoized; | |||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 1 | ▶ | method cache_memoized ($class:) { | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
cache_memoized: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||
| 10 | 34 | ▶ | $class = ref($class) || $class; | ||||||||||||||||||||||||||
|
Condition66%2/3
ref $class || $class
MC/DC0%0/2
ref $class || $class
ref $class
$class
Truth table66%2/3
A || B
A= ref $classB= $class
| |||||||||||||||||||||||||||||
| 11 | 34 | ▶ | if (@_) { $memoized{$class} = $_[0] } | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 12 | 34 | return $memoized{$class}; | |||||||||||||||||||||||||||
| 13 | 1 | } | |||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | 1 | ▶ | method cache_defaults ($class:) { $class->cmeta->interp->cache_defaults } | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
cache_defaults: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 16 | 1 | ▶ | method cache_root_class ($class:) { $class->cmeta->interp->cache_root_class } | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 17 | 1 | ▶ | method cache_namespace ($class:) { $class->cmeta->path } | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
cache_namespace: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | 1 | ▶ | method cache ($class:) { | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
cache: called CC=5 SCAR=16.2
| |||||||||||||||||||||||||||||
| 20 | 15 | ▶ | if ( !@_ && $class->cache_memoized ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
not @_ and $class->cache_memoized
MC/DC50%1/2
not @_ and $class->cache_memoized
not @_
$class->cache_memoized
Truth table66%2/3
not(A) and B
A= not @_B= $class->cache_memoized
| |||||||||||||||||||||||||||||
| 21 | 11 | return $class->cache_memoized; | |||||||||||||||||||||||||||
| 22 | } | ||||||||||||||||||||||||||||
| 23 | 4 | my $cache_root_class = $class->cache_root_class; | |||||||||||||||||||||||||||
| 24 | 4 | my %options = ( %{ $class->cache_defaults }, @_ ); | |||||||||||||||||||||||||||
| 25 | 4 | ▶ | if ( !exists( $options{namespace} ) ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 26 | 4 | $options{namespace} = $class->cache_namespace; | |||||||||||||||||||||||||||
| 27 | } | ||||||||||||||||||||||||||||
| 28 | 4 | my $cache = $cache_root_class->new(%options); | |||||||||||||||||||||||||||
| 29 | 4 | ▶ | if ( !@_ ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 30 | 4 | $class->cache_memoized($cache); | |||||||||||||||||||||||||||
| 31 | } | ||||||||||||||||||||||||||||
| 32 | 4 | return $cache; | |||||||||||||||||||||||||||
| 33 | 1 | } | |||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | 1 | 1; | |||||||||||||||||||||||||||