Config/Driver.pm

filter: Statementstmt 93.9% 31 / 33 Branchbran 100% 4 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 87.5% 7 / 8 Podpod 100% 2 / 2 totaltotal 93.6% 44 / 47 CC 3 SCAR 5.3
CC
3
Cov
95%
get_cache
3.0
source
2.0
BEGIN
1.0
CRAP 1.7
« Config.pm ↑ Summary Config/DriverPool.pm »
1 3 ▶use 5.006;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 package CHI::Config::Driver;
6  
7 3 our $VERSION = '0.001001'; # TRIAL
8  
9 # ABSTRACT: Container for Driver configuration
10  
11 3 our $AUTHORITY = 'cpan:KENTNL'; # AUTHORITY
12  
13 3 ▶use Moo qw( has );
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 3 has 'name' => ( is => 'ro', required => 1 );
16 3 has 'file' => ( is => 'ro', required => 1 );
17 3 has 'entry_no' => ( is => 'ro', required => 1 );
18 3 has 'config' => ( is => 'ro', required => 1 );
19 1 ▶has 'memoize' => ( is => 'ro', lazy => 1, default => sub { undef } );
Subroutine __ANON__: called CC=1 SCAR=0.0
20  
21 4 ▶sub get_cache {
Subroutine get_cache: called CC=3 SCAR=11.0
Pod documented
22 4 my ($self) = @_;
23 4 ▶ return $self->{_cache} if exists $self->{_cache};
Branch: 1 branch
BranchTrueFalseTotal
if exists $self->{"_cache"} 1 3 4
24  
25 3 require CHI;
26 3 require Storable;
27  
28 3 my $instance = CHI->new( %{ Storable::dclone( $self->config ) } );
29  
30 3 ▶ $self->{_cache} = $instance if $self->memoize;
Branch: 1 branch
BranchTrueFalseTotal
if $self->memoize 1 2 3
31  
32 3 return $instance;
33 }
34  
35 0 ▶sub source {
Subroutine source: not called CC=1 SCAR=6.9
Pod documented
36 0 my ($self) = @_;
37 0 return sprintf '%s ( entry #%s )', $self->file, $self->entry_no;
38 }
39  
40 3 ▶no Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
41  
42 3 1;
43  
44 __END__
« Config.pm ↑ Summary Config/DriverPool.pm »