File Coverage

blib/lib/MojoX/Plugin/AnyCache/Backend.pm
Criterion Covered Total %
statement 19 24 79.1
branch 3 6 50.0
condition 4 6 66.6
subroutine 4 9 44.4
pod 0 6 0.0
total 30 51 58.8


line stmt bran cond sub pod time code
1             package MojoX::Plugin::AnyCache::Backend;
2              
3 5     5   1767273 use strict;
  5         14  
  5         176  
4 5     5   30 use warnings;
  5         9  
  5         173  
5 5     5   28 use Mojo::Base '-base';
  5         9  
  5         119  
6              
7             has 'config';
8             has 'support_sync' => sub { 0 };
9             has 'support_async' => sub { 0 };
10             has 'serialiser';
11              
12             sub get_serialiser {
13 114     114 0 4347 my ($self) = @_;
14 114 100 100     3887 if(!$self->serialiser && (my $s = $self->config->{serialiser})) {
15 6         259 eval {
16 6         518 eval "require $s;";
17 6 0 33     184 warn("Require failed: $@") if $self->config->{debug} && $@;
18 6         175 my $serialiser = $self->config->{serialiser}->new;
19 6         235 $serialiser->config($self->config);
20 6         406 $self->serialiser($serialiser);
21             };
22 6 50       47 die("Failed to load serialiser $s: $@") if $@;
23             }
24 114         7767 return $self->serialiser;
25             }
26              
27 0     0 0   sub get { die("Must be overridden in backend module") };
28 0     0 0   sub set { die("Must be overridden in backend module") };
29 0     0 0   sub incr { die("Must be overridden in backend module") };
30 0     0 0   sub decr { die("Must be overridden in backend module") };
31 0     0 0   sub del { die("Must be overridden in backend module") };
32              
33             1;