line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DBIx::CheckConnectivity; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
2362
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
83
|
|
4
|
2
|
|
|
2
|
|
13
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
73
|
|
5
|
2
|
|
|
2
|
|
22
|
use Carp; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
193
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.02'; |
8
|
|
|
|
|
|
|
|
9
|
2
|
|
|
2
|
|
12
|
use base 'Exporter'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
221
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our @EXPORT = qw/check_connectivity/; |
12
|
|
|
|
|
|
|
|
13
|
2
|
|
|
2
|
|
5021
|
use DBI; |
|
2
|
|
|
|
|
62924
|
|
|
2
|
|
|
|
|
206
|
|
14
|
2
|
|
|
2
|
|
3146
|
use Params::Validate qw/:all/; |
|
2
|
|
|
|
|
36557
|
|
|
2
|
|
|
|
|
601
|
|
15
|
2
|
|
|
2
|
|
2942
|
use UNIVERSAL::require; |
|
2
|
|
|
|
|
6447
|
|
|
2
|
|
|
|
|
28
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub check_connectivity { |
18
|
10
|
|
|
10
|
1
|
2026
|
validate( |
19
|
|
|
|
|
|
|
@_, |
20
|
|
|
|
|
|
|
{ |
21
|
|
|
|
|
|
|
dsn => { type => SCALAR, regex => qr/^dbi:/ }, |
22
|
|
|
|
|
|
|
user => 0, |
23
|
|
|
|
|
|
|
password => 0, |
24
|
|
|
|
|
|
|
attribute => { type => HASHREF, optional => 1 }, |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
); |
27
|
10
|
|
|
|
|
217
|
my %args = @_; |
28
|
10
|
|
|
|
|
19
|
my $dsn = $args{dsn}; |
29
|
|
|
|
|
|
|
|
30
|
10
|
|
|
|
|
52
|
my ( $driver ) = $dsn =~ m/dbi:(\w+):/; |
31
|
10
|
|
|
|
|
21
|
my $driver_module = __PACKAGE__ . '::Driver::' . $driver; |
32
|
10
|
50
|
|
|
|
68
|
$driver_module->require |
33
|
|
|
|
|
|
|
or confess "$driver is not supported yet, sorry"; |
34
|
10
|
|
|
|
|
396
|
$driver_module->check_connectivity( @_ ); |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
1; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
__END__ |