| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Parse::CPAN::Modlist; |
|
2
|
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
2427
|
use strict; |
|
|
3
|
|
|
|
|
6
|
|
|
|
3
|
|
|
|
|
126
|
|
|
4
|
3
|
|
|
3
|
|
25
|
use vars qw($VERSION); |
|
|
3
|
|
|
|
|
5
|
|
|
|
3
|
|
|
|
|
145
|
|
|
5
|
3
|
|
|
3
|
|
2199
|
use Parse::CPAN::Modlist::Module; |
|
|
3
|
|
|
|
|
8
|
|
|
|
3
|
|
|
|
|
28
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
$VERSION = '0.9'; |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=pod |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 NAME |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
Parse::CPAN::Modlist - Parse 03packages.data.gz |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
use Parse::CPAN::Modlist; |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
my $p = Parse::CPAN::Modlist->new("t/data/03modlist.data"); |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
foreach my $name ($p->modules) { |
|
26
|
|
|
|
|
|
|
my $module = $p->module($name); |
|
27
|
|
|
|
|
|
|
print " The module '".$module->name."'". |
|
28
|
|
|
|
|
|
|
" is written by ".$module->author. |
|
29
|
|
|
|
|
|
|
" and is described as '".$module->description. |
|
30
|
|
|
|
|
|
|
"'\n"; |
|
31
|
|
|
|
|
|
|
} |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
The CPAN module list is a non-comprehensive list of modules on CPAN. |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
Or, more exactly, it's a comprehensive list of B modules on CPAN. |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
http://www.cpan.org/modules/00modlist.long.html has more details. |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head1 Methods |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=cut |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head2 new |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
Creates a new C object and parses the data passed in. |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
You can either pass in the path to a (not gzipped) file or the data from an |
|
50
|
|
|
|
|
|
|
03modlist.data file. |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=cut |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub new { |
|
55
|
2
|
|
|
2
|
1
|
667
|
my $class = shift; |
|
56
|
2
|
|
|
|
|
5
|
my $filename = shift; |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
|
|
59
|
2
|
|
|
|
|
6
|
my $self = { }; |
|
60
|
2
|
|
|
|
|
6
|
bless $self, $class; |
|
61
|
|
|
|
|
|
|
|
|
62
|
2
|
50
|
|
|
|
10
|
$filename = '03modlist.data' if not defined $filename; |
|
63
|
|
|
|
|
|
|
|
|
64
|
2
|
100
|
|
|
|
17
|
if ($filename =~ /File:\s+03modlist.data/) { |
|
65
|
1
|
|
|
|
|
8
|
$self->{_details} = $filename; |
|
66
|
|
|
|
|
|
|
} else { |
|
67
|
1
|
50
|
|
|
|
40
|
open(IN, $filename) || die "Failed to read $filename: $!"; |
|
68
|
1
|
|
|
|
|
17474
|
$self->{_details} = join '', ; |
|
69
|
1
|
|
|
|
|
2096
|
close(IN); |
|
70
|
|
|
|
|
|
|
} |
|
71
|
|
|
|
|
|
|
|
|
72
|
2
|
|
|
|
|
16
|
$self->parse; |
|
73
|
2
|
|
|
|
|
22
|
return $self; |
|
74
|
|
|
|
|
|
|
} |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head2 parse |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
Internal method which parses the 03modlist.data file. |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
Called automatically by C. |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=cut |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
### this builds a hash reference with the structure of the cpan module tree ### |
|
87
|
|
|
|
|
|
|
sub parse { |
|
88
|
2
|
|
|
2
|
1
|
8
|
my $self = shift; |
|
89
|
2
|
|
|
|
|
7
|
my $in = $self->{_details}; |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
### get rid of the comments and the code ### |
|
92
|
|
|
|
|
|
|
### need a smarter parser, some people have this in their dslip info: |
|
93
|
|
|
|
|
|
|
# [ |
|
94
|
|
|
|
|
|
|
# 'Statistics::LTU', |
|
95
|
|
|
|
|
|
|
# 'R', |
|
96
|
|
|
|
|
|
|
# 'd', |
|
97
|
|
|
|
|
|
|
# 'p', |
|
98
|
|
|
|
|
|
|
# 'O', |
|
99
|
|
|
|
|
|
|
# '?', |
|
100
|
|
|
|
|
|
|
# 'Implements Linear Threshold Units', |
|
101
|
|
|
|
|
|
|
# ...skipping... |
|
102
|
|
|
|
|
|
|
# "\x{c4}dd \x{fc}ml\x{e4}\x{fc}ts t\x{f6} \x{eb}v\x{eb}r\x{ff}th\x{ef}ng!", |
|
103
|
|
|
|
|
|
|
# 'BENNIE', |
|
104
|
|
|
|
|
|
|
# '11' |
|
105
|
|
|
|
|
|
|
# ], |
|
106
|
|
|
|
|
|
|
### also, older versions say: |
|
107
|
|
|
|
|
|
|
### $cols = [....] |
|
108
|
|
|
|
|
|
|
### and newer versions say: |
|
109
|
|
|
|
|
|
|
### $CPANPLUS::Modulelist::cols = [...] |
|
110
|
2
|
|
|
|
|
5876
|
$in =~ s|.+}\s+(\$(?:CPAN::Modulelist::)?cols)|$1|s; |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
### split '$cols' and '$data' into 2 variables ### |
|
113
|
2
|
|
|
|
|
804
|
my ($ds_one, $ds_two) = split ';', $in, 2; |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
### eval them into existance ### |
|
116
|
|
|
|
|
|
|
### still not too fond of this solution - kane ### |
|
117
|
2
|
|
|
|
|
5
|
my ($cols, $data); |
|
118
|
|
|
|
|
|
|
{ #local $@; can't use this, it's buggy -kane |
|
119
|
|
|
|
|
|
|
|
|
120
|
2
|
|
|
|
|
7
|
$cols = eval $ds_one; |
|
|
2
|
|
|
|
|
281
|
|
|
121
|
2
|
50
|
|
|
|
20
|
die "Error in eval of 03modlist.data source files: $@" if $@; |
|
122
|
|
|
|
|
|
|
|
|
123
|
2
|
|
|
|
|
565912
|
$data = eval $ds_two; |
|
124
|
2
|
50
|
|
|
|
459
|
die "Error in eval of 03modlist.data source files: $@" if $@; |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
} |
|
127
|
|
|
|
|
|
|
|
|
128
|
2
|
|
|
|
|
11
|
my $tree = {}; |
|
129
|
2
|
|
|
|
|
8
|
my $primary = "modid"; |
|
130
|
|
|
|
|
|
|
|
|
131
|
2
|
|
|
|
|
57
|
Parse::CPAN::Modlist::Module->mk_accessors(@$cols); |
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
### this comes from CPAN::Modulelist |
|
134
|
|
|
|
|
|
|
### which is in 03modlist.data.gz |
|
135
|
2
|
|
|
|
|
937
|
for (@$data){ |
|
136
|
5706
|
|
|
|
|
6290
|
my %hash; |
|
137
|
5706
|
|
|
|
|
37223
|
@hash{@$cols} = @$_; |
|
138
|
5706
|
|
|
|
|
12262
|
$hash{'chapterid'} = int($hash{'chapterid'}); |
|
139
|
5706
|
|
|
|
|
25773
|
$tree->{$hash{$primary}} = bless \%hash, 'Parse::CPAN::Modlist::Module';; |
|
140
|
|
|
|
|
|
|
} |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
|
|
143
|
2
|
|
|
|
|
12
|
$self->{modules} = $tree; |
|
144
|
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
} |
|
147
|
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=head2 module |
|
149
|
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
Returns a C object representing |
|
151
|
|
|
|
|
|
|
the module name passed in or undef if that module is not in the |
|
152
|
|
|
|
|
|
|
module list. |
|
153
|
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=cut |
|
155
|
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
sub module { |
|
157
|
4
|
|
|
4
|
1
|
7756
|
my $self = shift; |
|
158
|
4
|
|
|
|
|
8
|
my $module = shift; |
|
159
|
4
|
|
|
|
|
25
|
return $self->{modules}->{$module}; |
|
160
|
|
|
|
|
|
|
} |
|
161
|
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
=head2 modules |
|
164
|
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
Returns a list of the names of all modules in the module list |
|
166
|
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
=cut |
|
168
|
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
sub modules { |
|
170
|
2
|
|
|
2
|
1
|
5
|
return keys %{$_[0]->{modules}}; |
|
|
2
|
|
|
|
|
15
|
|
|
171
|
|
|
|
|
|
|
} |
|
172
|
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
=head1 BUGS |
|
175
|
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
None that I know of. |
|
177
|
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
=head1 COPYING |
|
179
|
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
Distributed under the same terms as Perl itself. |
|
181
|
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
=head1 AUTHOR |
|
183
|
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
Copyright (c) 2004, |
|
185
|
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
Simon Wistow |
|
187
|
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
based on code from C by Jos Boumans. |
|
189
|
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
191
|
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
L, L |
|
193
|
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
=cut |
|
195
|
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
1; |