line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Perl::Metrics::CDBI; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# The Perl::Metrics::CDBI class acts as a base class for the index and |
4
|
|
|
|
|
|
|
# provides the integration with Class::DBI. |
5
|
|
|
|
|
|
|
# |
6
|
|
|
|
|
|
|
# It has no user-servicable parts at this time |
7
|
|
|
|
|
|
|
|
8
|
6
|
|
|
6
|
|
32
|
use strict; |
|
6
|
|
|
|
|
11
|
|
|
6
|
|
|
|
|
222
|
|
9
|
6
|
|
|
6
|
|
30
|
use base 'Class::DBI'; |
|
6
|
|
|
|
|
11
|
|
|
6
|
|
|
|
|
17047
|
|
10
|
6
|
|
|
6
|
|
346928
|
use Carp (); |
|
6
|
|
|
|
|
17
|
|
|
6
|
|
|
|
|
92
|
|
11
|
6
|
|
|
6
|
|
35
|
use DBI (); |
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
89
|
|
12
|
6
|
|
|
6
|
|
9462
|
use DBD::SQLite (); |
|
6
|
|
|
|
|
64643
|
|
|
6
|
|
|
|
|
180
|
|
13
|
|
|
|
|
|
|
|
14
|
6
|
|
|
6
|
|
57
|
use vars qw{$VERSION $DSN}; |
|
6
|
|
|
|
|
15
|
|
|
6
|
|
|
|
|
449
|
|
15
|
|
|
|
|
|
|
BEGIN { |
16
|
6
|
|
|
6
|
|
15
|
$VERSION = '0.09'; |
17
|
6
|
|
|
|
|
712
|
$DSN = undef; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
##################################################################### |
25
|
|
|
|
|
|
|
# Class::DBI Methods |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub db_Main { |
28
|
|
|
|
|
|
|
# We must have the database location defined |
29
|
72
|
50
|
|
72
|
1
|
211695
|
unless ( $DSN ) { |
30
|
0
|
|
|
|
|
0
|
Carp::croak("No DSN defined for Perl::Metrics::CDBI"); |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
# Unless we use Class::DBI's attributes, the whole thing comes |
34
|
|
|
|
|
|
|
# tumbling horribly down around us. Yes, this completely sucks. |
35
|
72
|
|
|
|
|
713
|
my %attr = Class::DBI->_default_attributes; |
36
|
|
|
|
|
|
|
|
37
|
72
|
50
|
|
|
|
12685
|
DBI->connect( $DSN, '', '', \%attr ) |
38
|
|
|
|
|
|
|
or Carp::croak("Error connecting to Perl::Metrics database at $DSN"); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
1; |