| 1 | package Prancer::Session::Store::Database::Driver::Mock; | ||||||||||
| 2 | |||||||||||
| 3 | 2 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 2 | ▶ | use warnings FATAL => 'all'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 2 | ▶ | use version; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 2 | our $VERSION = '1.01'; | |||||||||
| 8 | |||||||||||
| 9 | 2 | ▶ | use Prancer::Session::Store::Database::Driver; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | 2 | ▶ | use parent qw(Prancer::Session::Store::Database::Driver); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | |||||||||||
| 12 | 2 | ▶ | use Try::Tiny; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 13 | 2 | ▶ | use Carp; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 14 | |||||||||||
| 15 | # even though this *should* work automatically, it was not | ||||||||||
| 16 | 2 | our @CARP_NOT = qw(Prancer Try::Tiny); | |||||||||
| 17 | |||||||||||
| 18 | 3 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=1 SCAR=0.3
Pod
documented
| |||||||||||
| 19 | 3 | my $class = shift; | |||||||||
| 20 | 3 | my $self = bless($class->SUPER::new(@_), $class); | |||||||||
| 21 | |||||||||||
| 22 | 3 | ▶ | try { | ||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||
| 23 | 3 | require DBD::Mock; | |||||||||
| 24 | 0 | ▶ | } catch { | ||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||
| 25 | 0 | ▶ | my $error = (defined($_) ? $_ : "unknown"); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 26 | 0 | croak "could not initialize session handler: could not load DBD::Mock: ${error}"; | |||||||||
| 27 | 3 | }; | |||||||||
| 28 | |||||||||||
| 29 | 3 | my $dsn = "dbi:Mock:"; | |||||||||
| 30 | |||||||||||
| 31 | 3 | my $params = { | |||||||||
| 32 | 'AutoCommit' => 0, | ||||||||||
| 33 | 'RaiseError' => 1, | ||||||||||
| 34 | 'PrintError' => 0, | ||||||||||
| 35 | }; | ||||||||||
| 36 | |||||||||||
| 37 | # merge in any additional dsn_params | ||||||||||
| 38 | 3 | $params = $self->_merge($params, $self->{'_dsn_extra'}); | |||||||||
| 39 | |||||||||||
| 40 | 3 | $self->{'_dsn'} = [ $dsn, undef, undef, $params ]; | |||||||||
| 41 | 3 | return $self; | |||||||||
| 42 | } | ||||||||||
| 43 | |||||||||||
| 44 | 2 | 1; | |||||||||