| 1 | package Terse::Plugin::DBI; | ||||||||||
| 2 | 1 | ▶ | use 5.006; use strict; use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 1 | our $VERSION = '0.05'; | |||||||||
| 4 | 1 | ▶ | use base 'Terse::Plugin'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 1 | ▶ | use DBI; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 0 | ▶ | sub connect { | ||||||||
|
Subroutine
connect: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 9 | 0 | my ($self, $t) = @_; | |||||||||
| 10 | 0 | my ($dsn, $user, $password) = $self->connect_info($t); | |||||||||
| 11 | 0 | ▶ | if (!$dsn) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 12 | 0 | $t->logError('No dsn found for DBI conntection', 400); | |||||||||
| 13 | 0 | return; | |||||||||
| 14 | } | ||||||||||
| 15 | 0 | my $dbi = DBI->connect($dsn, $user, $password); | |||||||||
| 16 | 0 | return $dbi; | |||||||||
| 17 | } | ||||||||||
| 18 | |||||||||||
| 19 | 0 | ▶ | sub connect_info { | ||||||||
|
Subroutine
connect_info: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 20 | 0 | my ($self, $t) = @_; | |||||||||
| 21 | 0 | my $conf = $t->plugin('config')->find('coredb'); | |||||||||
| 22 | 0 | return ($conf->{dsn}, $conf->{user}, $conf->{password}); | |||||||||
| 23 | } | ||||||||||
| 24 | |||||||||||
| 25 | 1 | 1; | |||||||||
| 26 | |||||||||||
| 27 | __END__ | ||||||||||