line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Class::DBI::SAK; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
19146
|
use vars qw[$VERSION %EXTENSIONS @OVERRIDES]; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
71
|
|
4
|
1
|
|
|
1
|
|
5
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
89
|
|
5
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
532
|
|
6
|
|
|
|
|
|
|
# use warnings; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
$VERSION = '1.4'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
%EXTENSIONS = ( |
11
|
|
|
|
|
|
|
':useful' => { |
12
|
|
|
|
|
|
|
'AbstractSearch' => 'use %s', |
13
|
|
|
|
|
|
|
'Pager' => 'use %s', |
14
|
|
|
|
|
|
|
}, |
15
|
|
|
|
|
|
|
':mysql' => { |
16
|
|
|
|
|
|
|
'mysql' => 'use base qw[%s]', |
17
|
|
|
|
|
|
|
'mysql::FullTextSearch' => 'use %s', |
18
|
|
|
|
|
|
|
}, |
19
|
|
|
|
|
|
|
'Extension' => 'use base qw[%s]', |
20
|
|
|
|
|
|
|
'FromCGI' => 'use %s', |
21
|
|
|
|
|
|
|
'Pg' => 'use base qw[%s]', |
22
|
|
|
|
|
|
|
'Replication' => 'use base qw[%s]', |
23
|
|
|
|
|
|
|
'SQLite' => 'use base qw[%s]', |
24
|
|
|
|
|
|
|
); |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
$EXTENSIONS{':all'} = { map { |
27
|
|
|
|
|
|
|
ref $EXTENSIONS{$_} ? |
28
|
|
|
|
|
|
|
%{$EXTENSIONS{$_}} : |
29
|
|
|
|
|
|
|
( $_ => $EXTENSIONS{$_} ) |
30
|
|
|
|
|
|
|
} keys %EXTENSIONS }; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
@OVERRIDES = ( qw[ |
33
|
|
|
|
|
|
|
Extension mysql Pg Replication SQLite |
34
|
|
|
|
|
|
|
] ); |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub import { |
37
|
1
|
|
|
1
|
|
7
|
my ($class, @requests) = @_; |
38
|
1
|
|
|
|
|
3
|
my $caller = caller(0); |
39
|
1
|
|
|
|
|
1
|
my %modules = (); |
40
|
1
|
|
|
|
|
2
|
my @uses = (); |
41
|
|
|
|
|
|
|
|
42
|
1
|
50
|
|
|
|
4
|
@requests = ':useful' unless @requests; |
43
|
|
|
|
|
|
|
|
44
|
1
|
|
|
|
|
2
|
foreach my $req ( @requests ) { |
45
|
1
|
50
|
|
|
|
7
|
if ( substr( $req, 0, 1 ) eq ':' ) { |
46
|
1
|
50
|
|
|
|
3
|
if ( exists $EXTENSIONS{$req} ) { |
47
|
1
|
|
|
|
|
6
|
$modules{$_} = $EXTENSIONS{$req}->{$_} |
48
|
1
|
|
|
|
|
1
|
foreach keys %{$EXTENSIONS{$req}}; |
49
|
|
|
|
|
|
|
} else { |
50
|
0
|
|
|
|
|
0
|
croak "$class does not export a $req tag"; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
} else { |
53
|
0
|
0
|
|
|
|
0
|
if ( exists $EXTENSIONS{':all'}->{$req} ) { |
54
|
0
|
|
|
|
|
0
|
$modules{$req} = $EXTENSIONS{':all'}->{$req}; |
55
|
|
|
|
|
|
|
} else { |
56
|
0
|
|
|
|
|
0
|
croak "$class does not export $req\n"; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
1
|
|
|
|
|
4
|
while ( my ($name, $use) = each %modules ) { |
62
|
2
|
|
|
|
|
24
|
push @uses, sprintf $use, "Class::DBI::$name"; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
5
|
|
|
|
|
11
|
unshift @uses, 'use base qw[Class::DBI]' |
66
|
1
|
50
|
|
|
|
2
|
unless grep { exists $modules{$_} } @OVERRIDES; |
67
|
|
|
|
|
|
|
|
68
|
1
|
|
|
|
|
6
|
@uses = sort { ( () = $b =~ /base/ ) <=> ( () = $a =~ /base/ ) } @uses; |
|
3
|
|
|
|
|
9
|
|
69
|
|
|
|
|
|
|
|
70
|
3
|
|
|
|
|
8
|
my $statement = join ";\n", sort { |
71
|
1
|
|
|
|
|
2
|
( () = $b =~ /base/ ) <=> ( () = $a =~ /base/ ) |
72
|
|
|
|
|
|
|
} @uses; |
73
|
1
|
|
|
|
|
1
|
$statement .= ";\n"; |
74
|
|
|
|
|
|
|
|
75
|
1
|
|
|
1
|
|
6
|
eval qq[ |
|
1
|
|
|
1
|
|
2
|
|
|
1
|
|
|
1
|
|
333152
|
|
|
1
|
|
|
|
|
96909
|
|
|
1
|
|
|
|
|
27961
|
|
|
1
|
|
|
|
|
70
|
|
|
1
|
|
|
|
|
1022
|
|
|
1
|
|
|
|
|
5263
|
|
|
1
|
|
|
|
|
10
|
|
|
1
|
|
|
|
|
75
|
|
76
|
|
|
|
|
|
|
package $caller; |
77
|
|
|
|
|
|
|
$statement; |
78
|
|
|
|
|
|
|
package $class; |
79
|
|
|
|
|
|
|
]; |
80
|
1
|
50
|
|
|
|
54
|
croak $@ if $@; |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
1; |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
__END__ |