File Coverage

blib/lib/Prancer/Session/Store/Database/Driver/Mock.pm
Criterion Covered Total %
statement 29 31 93.5
branch 0 2 0.0
condition n/a
subroutine 9 10 90.0
pod 1 1 100.0
total 39 44 88.6


line stmt bran cond sub pod time code
1             package Prancer::Session::Store::Database::Driver::Mock;
2              
3 2     2   21210 use strict;
  2         2  
  2         60  
4 2     2   8 use warnings FATAL => 'all';
  2         2  
  2         63  
5              
6 2     2   400 use version;
  2         1294  
  2         10  
7             our $VERSION = '1.00';
8              
9 2     2   496 use Prancer::Session::Store::Database::Driver;
  2         3  
  2         51  
10 2     2   7 use parent qw(Prancer::Session::Store::Database::Driver);
  2         2  
  2         9  
11              
12 2     2   106 use Try::Tiny;
  2         3  
  2         88  
13 2     2   8 use Carp;
  2         2  
  2         367  
14              
15             # even though this *should* work automatically, it was not
16             our @CARP_NOT = qw(Prancer Try::Tiny);
17              
18             sub new {
19 3     3 1 4424 my $class = shift;
20 3         41 my $self = bless($class->SUPER::new(@_), $class);
21              
22             try {
23 3     3   640 require DBD::Mock;
24             } catch {
25 0 0   0   0 my $error = (defined($_) ? $_ : "unknown");
26 0         0 croak "could not initialize session handler: could not load DBD::Mock: ${error}";
27 3         21 };
28              
29 3         9734 my $dsn = "dbi:Mock:";
30              
31 3         15 my $params = {
32             'AutoCommit' => 0,
33             'RaiseError' => 1,
34             'PrintError' => 0,
35             };
36              
37 3         7 $self->{'_dsn'} = [ $dsn, undef, undef, $params ];
38 3         8 return $self;
39             }
40              
41             1;