line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Module::CoreList::DBSchema; |
2
|
|
|
|
|
|
|
$Module::CoreList::DBSchema::VERSION = '0.08'; |
3
|
|
|
|
|
|
|
#ABSTRACT: A database schema for Module::CoreList |
4
|
|
|
|
|
|
|
|
5
|
4
|
|
|
4
|
|
56918
|
use strict; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
96
|
|
6
|
4
|
|
|
4
|
|
12
|
use warnings; |
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
99
|
|
7
|
4
|
|
|
4
|
|
1386
|
use Clone qw[clone]; |
|
4
|
|
|
|
|
7555
|
|
|
4
|
|
|
|
|
234
|
|
8
|
4
|
|
|
4
|
|
8489
|
use Module::CoreList; |
|
4
|
|
|
|
|
126078
|
|
|
4
|
|
|
|
|
34
|
|
9
|
4
|
|
|
4
|
|
4975
|
use SQL::Abstract; |
|
4
|
|
|
|
|
32849
|
|
|
4
|
|
|
|
|
1786
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
my $tables = { |
12
|
|
|
|
|
|
|
cl_perls => [ |
13
|
|
|
|
|
|
|
'perl_ver VARCHAR(20) NOT NULL', |
14
|
|
|
|
|
|
|
'released VARCHAR(10)', |
15
|
|
|
|
|
|
|
], |
16
|
|
|
|
|
|
|
cl_versions => [ |
17
|
|
|
|
|
|
|
'perl_ver VARCHAR(20) NOT NULL', |
18
|
|
|
|
|
|
|
'mod_name VARCHAR(300) NOT NULL', |
19
|
|
|
|
|
|
|
'mod_vers VARCHAR(30)', |
20
|
|
|
|
|
|
|
'deprecated BOOL', |
21
|
|
|
|
|
|
|
], |
22
|
|
|
|
|
|
|
cl_families => [ |
23
|
|
|
|
|
|
|
'perl_ver VARCHAR(20) NOT NULL', |
24
|
|
|
|
|
|
|
'family VARCHAR(20) NOT NULL', |
25
|
|
|
|
|
|
|
], |
26
|
|
|
|
|
|
|
cl_upstream => [ |
27
|
|
|
|
|
|
|
'mod_name VARCHAR(300) NOT NULL', |
28
|
|
|
|
|
|
|
'upstream VARCHAR(20)', |
29
|
|
|
|
|
|
|
], |
30
|
|
|
|
|
|
|
cl_bugtracker => [ |
31
|
|
|
|
|
|
|
'mod_name VARCHAR(300) NOT NULL', |
32
|
|
|
|
|
|
|
'url TEXT', |
33
|
|
|
|
|
|
|
], |
34
|
|
|
|
|
|
|
}; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
my $queries = { |
37
|
|
|
|
|
|
|
corelist => [ 'select cl_perls.perl_ver, mod_vers, released, deprecated from cl_versions,cl_perls where cl_perls.perl_ver = cl_versions.perl_ver and mod_name = ? order by cl_versions.perl_ver', 1 ], |
38
|
|
|
|
|
|
|
}; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
my $sql = SQL::Abstract->new(); |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub new { |
43
|
4
|
|
|
4
|
1
|
191
|
my $package = shift; |
44
|
4
|
|
|
|
|
12
|
my %opts = @_; |
45
|
4
|
|
|
|
|
13
|
$opts{lc $_} = delete $opts{$_} for keys %opts; |
46
|
4
|
|
|
|
|
10
|
my $self = bless \%opts, $package; |
47
|
4
|
|
|
|
|
16
|
return $self; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub tables { |
51
|
1
|
|
|
1
|
1
|
35
|
my $clone = clone( $tables ); |
52
|
1
|
50
|
|
|
|
4
|
return %{ $clone } if wantarray; |
|
1
|
|
|
|
|
5
|
|
53
|
0
|
|
|
|
|
0
|
return $clone; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub data { |
57
|
1
|
|
|
1
|
1
|
4
|
my $self = shift; |
58
|
1
|
|
|
|
|
1
|
my %opts = @_; |
59
|
1
|
|
|
|
|
3
|
$opts{lc $_} = delete $opts{$_} for keys %opts; |
60
|
1
|
|
50
|
|
|
6
|
my $prefix = $opts{prefix} || ''; |
61
|
1
|
|
|
|
|
2
|
my $data = []; |
62
|
1
|
|
|
|
|
40
|
foreach my $perl ( keys %Module::CoreList::version ) { |
63
|
140
|
|
|
|
|
41430
|
push @{ $data }, [ $sql->insert( $prefix . 'cl_perls', [ $perl, $Module::CoreList::released{$perl} ] ) ]; |
|
140
|
|
|
|
|
1057
|
|
64
|
140
|
|
|
|
|
16359
|
foreach my $mod ( keys %{ $Module::CoreList::version{ $perl } } ) { |
|
140
|
|
|
|
|
912
|
|
65
|
78299
|
|
|
|
|
12923222
|
my $modver = $Module::CoreList::version{ $perl }{ $mod }; |
66
|
78299
|
100
|
|
|
|
446232
|
$modver = '' unless $modver; |
67
|
78299
|
|
100
|
|
|
176237
|
my $deprecated = $Module::CoreList::deprecated{ $perl }{ $mod } || 0; |
68
|
78299
|
|
|
|
|
8903299
|
push @{ $data }, [ |
|
78299
|
|
|
|
|
279124
|
|
69
|
|
|
|
|
|
|
$sql->insert( $prefix . 'cl_versions', [ $perl, $mod, $modver, $deprecated ] ) |
70
|
|
|
|
|
|
|
]; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
} |
73
|
1
|
|
|
|
|
267
|
foreach my $family ( keys %Module::CoreList::families ) { |
74
|
119
|
|
|
|
|
10530
|
push @{ $data }, [ |
75
|
|
|
|
|
|
|
$sql->insert( $prefix . 'cl_families', [ $_, $family ] ) |
76
|
23
|
|
|
|
|
2359
|
] for @{ $Module::CoreList::families{ $family } }; |
|
23
|
|
|
|
|
45
|
|
77
|
|
|
|
|
|
|
} |
78
|
1
|
|
|
|
|
227
|
foreach my $mod ( keys %Module::CoreList::upstream ) { |
79
|
400
|
|
|
|
|
2355
|
push @{ $data }, [ |
80
|
400
|
|
50
|
|
|
60647
|
$sql->insert( $prefix . 'cl_upstream', [ $mod, ( $Module::CoreList::upstream{ $mod } || '' ) ] ) |
81
|
|
|
|
|
|
|
]; |
82
|
|
|
|
|
|
|
} |
83
|
1
|
|
|
|
|
331
|
foreach my $mod ( keys %Module::CoreList::bug_tracker ) { |
84
|
398
|
|
|
|
|
2016
|
push @{ $data }, [ |
85
|
398
|
|
100
|
|
|
46780
|
$sql->insert( $prefix . 'cl_bugtracker', [ $mod, ( $Module::CoreList::bug_tracker{ $mod } || '' ) ] ) |
86
|
|
|
|
|
|
|
]; |
87
|
|
|
|
|
|
|
} |
88
|
1
|
50
|
|
|
|
148
|
return @{ $data } if wantarray; |
|
0
|
|
|
|
|
0
|
|
89
|
1
|
|
|
|
|
6
|
return $data; |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
sub queries { |
93
|
1
|
|
|
1
|
1
|
7
|
return keys %{ $queries }; |
|
1
|
|
|
|
|
4
|
|
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
sub query { |
97
|
2
|
|
|
2
|
1
|
508
|
my $self = shift; |
98
|
2
|
|
50
|
|
|
6
|
my $query = shift || return; |
99
|
2
|
50
|
|
|
|
5
|
return unless exists $queries->{ $query }; |
100
|
2
|
|
|
|
|
3
|
my $sql = $queries->{ $query }; |
101
|
2
|
100
|
|
|
|
6
|
return @{ $sql } if wantarray; |
|
1
|
|
|
|
|
3
|
|
102
|
1
|
|
|
|
|
2
|
return $sql; |
103
|
|
|
|
|
|
|
} |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
q[Modules are our business]; |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
__END__ |