Slick/DatabaseExecutor/MySQL.pm untested

filter: Statementstmt 0.0% 0 / 24 Branchbran 0.0% 0 / 8 Conditioncond 0.0% 0 / 4 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 0.0% 0 / 4 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 42 CC 5 SCAR 29.7
CC
5
Cov
0%
BUILD
30.0
BEGIN
2.0
BEGIN
2.0
CRAP 19.5
1 package Slick::DatabaseExecutor::MySQL;
2  
3 use 5.036;
4  
5 use Moo;
6 use Carp qw(croak);
7  
8 with 'Slick::DatabaseExecutor';
9  
10 sub BUILD {
11 my $self = shift;
12  
13 my $db = split /\//x, $self->{connection}->path;
14  
15 my $dsn = defined $db ? "dbi:mysql:dbname=$db" : "dbi:Pg";
16 if ( my $host = $self->{connection}->host ) { $dsn .= ";host=$host"; }
17 if ( my $port = $self->{connection}->port ) { $dsn .= ";port=$port"; }
18  
19 my ( $username, $password ) =
20 split /\:/x, [ split /\@/x, $self->{connection}->authority ]->[0];
21  
22 $self->{dbi} = DBI->connect( $dsn, $username // '', $password // '',
23 $self->dbi_options );
24  
25 croak qq{Couldn't connect to database: } . $self->{connection}
26 unless $self->dbi->ping;
27  
28 return $self;
29 }
30  
31 1;
32  
33 =encoding utf8
34  
35 =head1 NAME
36  
37 Slick::DatabaseExecutor::MySQL
38  
39 =head1 SYNOPSIS
40  
41 A child class of L<Slick::DatabaseExecutor>, handles all interactions with MySQL, mostly just configuring the connection.
42  
43 =head1 See also
44  
45 =over 2
46  
47 =item * L<Slick>
48  
49 =item * L<Slick::RouteManager>
50  
51 =item * L<Slick::Context>
52  
53 =item * L<Slick::Database>
54  
55 =item * L<Slick::DatabaseExecutor>
56  
57 =item * L<Slick::DatabaseExecutor::Pg>
58  
59 =item * L<Slick::EventHandler>
60  
61 =item * L<Slick::Events>
62  
63 =item * L<Slick::Methods>
64  
65 =item * L<Slick::RouteMap>
66  
67 =item * L<Slick::Util>
68  
69 =back
70  
71 =cut