lib/Module/Packaged/Report.pm

filter: Statementstmt 18.5% 35 / 189 Branchbran 0.0% 0 / 28 Conditioncond 0.0% 0 / 13 MC/DCmcdc 0.0% 0 / 7 Subroutinesub 27.7% 10 / 36 Podpod 40.0% 2 / 5 totaltotal 16.9% 47 / 278 CC 33 SCAR 30.0
CC
33
Cov
15%
_generate_missing_from
72.0
_process_data
42.0
_generate_per_author_report
30.0
CRAP 20.1
↑ Summary script/create_package_report.pl »
1 package Module::Packaged::Report;
2 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 1 ▶use Module::Packaged qw();
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use Module::Packaged::Generate qw();
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use HTML::Template qw();
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use File::Spec qw();
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use File::Path qw(mkpath);
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use Parse::CPAN::Packages qw();
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 ▶use App::Cache qw();
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 ▶use YAML qw(Load);
Subroutine BEGIN: called CC=1 SCAR=0.0
13 #use Data::Dumper qw(Dumper);
14  
15 1 our $VERSION = '0.04';
16  
17 1 my @letters = ('A'..'Z');
18 1 my @distributions;
19 1 my $yml = <<'END_YAML';
20 ---
21 - name: debian
22 real: Debian Unstable
23 source: debian_unstable
24 title: Debian
25 - name: debian
26 real: Debian Stable
27 source: debian_stable
28 title: ''
29 - name: debian
30 real: Debian Testing
31 source: debian_testing
32 title: ''
33 - name: ubuntu
34 real: Ubuntu Gutsy Gibbon 7.10 main
35 source: ubuntu_gutsy_main
36 title: ''
37 - name: ubuntu
38 real: Ubuntu Gutsy Gibbon 7.10 universe
39 source: ubuntu_gutsy_universe
40 title: ''
41 - name: ubuntu
42 real: Ubuntu Feisty Fawn 7.04 main
43 source: ubuntu_feisty_main
44 title: Ubuntu
45 - name: ubuntu
46 real: Ubuntu Feisty Fawn 7.04 universe
47 source: ubuntu_feisty_universe
48 title: ''
49 - name: ubuntu
50 real: Ubuntu Edgy Eft 6.10 main
51 source: ubuntu_edgy_main
52 title: ''
53 - name: ubuntu
54 real: Ubuntu Edgy Eft 6.10 universe
55 source: ubuntu_edgy_universe
56 title: ''
57 - name: ubuntu
58 real: Ubuntu Dapper Drake 6.06 main
59 source: ubuntu_dapper_main
60 title: ''
61 - name: ubuntu
62 real: Ubuntu Dapper Drake 6.06 universe
63 source: ubuntu_dapper_universe
64 title: ''
65 - name: ubuntu
66 real: Ubuntu Breezy Badger 5.10
67 source: ubuntu_breezy_main
68 title: ''
69 - name: ubuntu
70 real: Ubuntu Hoary Hedgehog 5.04
71 source: ubuntu_hoary_main
72 title: ''
73 - name: ubuntu
74 real: Ubuntu Warty Warthog 4.10
75 source: ubuntu_warty_main
76 title: ''
77 - name: fedora
78 real: Fedora FC2
79 source: fedora
80 title: Fedora
81 - name: freebsd
82 real: FreeBSD
83 source: freebsd
84 title: FreeBSD
85 - name: mandriva
86 real: Mandriva
87 source: mandriva
88 title: Mandriva
89 - name: openbsd
90 real: OpenBSD
91 source: openbsd
92 title: OpenBSD
93 - name: suse
94 real: Suse
95 source: suse
96 title: Suse
97 - name: gentoo
98 real: Gentoo
99 source: gentoo
100 title: Gentoo
101 - name: activeperl_8xx_windows
102 real: ActivePerl 8xx Windows
103 source: activeperl_8xx_windows
104 title: ActivePerl 8xx Windows
105 - name: activeperl_8xx_solaris
106 real: ActivePerl 8xx Solaris
107 source: activeperl_8xx_solaris
108 title: ''
109 - name: activeperl_8xx_linux
110 real: ActivePerl 8xx Linux
111 source: activeperl_8xx_linux
112 title: ''
113 - name: activeperl_8xx_hp-ux
114 real: ActivePerl 8xx HP-UX
115 source: activeperl_8xx_hp-ux
116 title: ''
117 - name: activeperl_8xx_darwin
118 real: ActivePerl 8xx Darwin
119 source: activeperl_8xx_darwin
120 title: ''
121 END_YAML
122  
123  
124 0 ▶sub new {
Subroutine new: not called CC=4 SCAR=30.0
Pod documented
125 0 my ($class, %opts) = @_;
126 0 ▶ usage() if $opts{help};
Branch: 1 branch
BranchTrueFalseTotal
if $opts{"help"} 0 0 0
127 0 ▶ usage() if not ($opts{test} xor $opts{real});
Branch: 1 branch
BranchTrueFalseTotal
unless $opts{"test"} xor $opts{"real"} 0 0 0
Condition0%0/4
$opts{"test"} xor $opts{"real"}
l&&rl&&!r!l&&r!l&&!r
0000
MC/DC0%0/2
$opts{"test"} xor $opts{"real"}
$opts{"test"} $opts{"real"}
Truth table0%0/4
A xor B
A= $opts{"test"}B= $opts{"real"}
ABresult
110
101
011
000
128  
129 0 @distributions = @{ Load($yml) };
130  
131 0 my $self = bless {}, $class;
132 0 $self->{opts} = \%opts;
133 #$self->{p} = Module::Packaged->new();
134 0 $self->{_timestamp} = time;
135  
136 0 my $cache = App::Cache->new({ ttl => 60 * 60 * 24 *7 });
137 0 my $data = $cache->get_url('http://www.cpan.org/modules/02packages.details.txt.gz');
138 0 $self->{pcp} = Parse::CPAN::Packages->new($data);
139 0 $self->{count} = {};
140  
141 0 return $self;
142 }
143  
144 0 ▶sub collect_data {
Subroutine collect_data: not called CC=1 SCAR=6.9
Pod undocumented
145 0 my ($self) = @_;
146 0 $self->{p} = Module::Packaged::Generate->new;
147 0 $self->{p}->fetch_all;
148 }
149  
150 0 ▶sub _timestamp {
Subroutine _timestamp: not called CC=1 SCAR=6.9
151 0 my ($self) = @_;
152 0 return scalar localtime $self->{_timestamp};
153 }
154  
155 0 ▶sub _list_packages {
Subroutine _list_packages: not called CC=2 SCAR=17.9
156 0 my ($self) = @_;
157 0 ▶ if ($self->{opts}{test}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'opts'}{'test'}) { } 0 0 0
158 0 return qw(AcePerl Acme-Buffy CGI DBD-Pg DBI Spreadsheet-ParseExcel);
159 } else {
160 0 return sort keys %{ $self->{p}{data} };
161 }
162 }
163  
164 0 ▶sub generate_html_report {
Subroutine generate_html_report: not called CC=1 SCAR=6.9
Pod documented
165 0 my ($self) = @_;
166  
167 0 my $dir = $self->_dir;
168 0 mkpath (File::Spec->catfile($dir, 'letters'));
169 0 mkpath (File::Spec->catfile($dir, 'distros'));
170 0 mkpath (File::Spec->catfile($dir, 'authors'));
171 0 mkpath (File::Spec->catfile($dir, 'missing'));
172  
173 0 $self->_save_style;
174  
175 0 $self->_process_data;
176  
177 0 $self->_generate_report_for_letters;
178 0 $self->_generate_per_distribution_reports;
179 0 $self->_generate_per_author_report;
180  
181 0 $self->_generate_missing_reports;
182 0 $self->_generate_main_index;
183 }
184  
185 0 ▶sub _process_data {
Subroutine _process_data: not called CC=6 SCAR=37.4
186 0 my ($self) = @_;
187  
188 0 foreach my $dash_name ($self->_list_packages) {
189 0 my $dists = $self->{p}->check($dash_name);
190 0 my $name = $dash_name;
191 0 $name =~ s/-/::/g;
192  
193 0 $self->{count}{cpan}++;
194 0 ▶ next if 1 >= keys %$dists; # skip modules that are only on CPAN
Branch: 1 branch
BranchTrueFalseTotal
if 1 >= keys %$dists 0 0 0
195  
196 # collect data for list of modules in a single distro
197 0 foreach my $distro (keys %$dists) {
198 0 ▶ next if $distro eq 'cpan';
Branch: 1 branch
BranchTrueFalseTotal
if $distro eq "cpan" 0 0 0
199 0 $self->{count}{$distro}++;
200 0 push @{ $self->{distros}{$distro} }, {
201 name => $name,
202 version => $dists->{$distro},
203 cpan => $dists->{cpan},
204 0 };
205 }
206  
207 # collect data for modules by each author
208 0 my $m = $self->{pcp}->package($name);
209 0 $dists->{name} = $name;
210 0 ▶ if ($m) {
Branch: 1 branch
BranchTrueFalseTotal
if ($m) { } 0 0 0
211 0 my $d = $m->distribution;
212 0 push @{ $self->{authors}{uc $d->cpanid} }, $dists;
213 } else {
214 #warn "No package for '$name'\n";
215 }
216 }
217 }
218  
219  
220  
221 0 ▶sub _generate_main_index {
Subroutine _generate_main_index: not called CC=2 SCAR=17.9
222 0 my ($self) = @_;
223 0 my @letters_hashes = map {{letter => $_}} @letters;
224 0 my @distros;
225 0 foreach my $d (@distributions) {
226 push @distros, {
227 title => $d->{real},
228 name => $d->{source},
229 count => $self->{count}{ $d->{source} },
230 0 };
231 }
232  
233 $self->create_file(
234 template => $self->_index_tmpl(),
235 filename => File::Spec->catfile($self->_dir, "index.html"),
236 params => {
237 letters => \@letters_hashes,
238 footer => $self->_footer(),
239 cpan => $self->{count}{cpan},
240 0 distros => \@distros,
241 },
242 );
243 }
244  
245 0 ▶sub _generate_per_distribution_reports {
Subroutine _generate_per_distribution_reports: not called CC=3 SCAR=24.8
246 0 my ($self) = @_;
247 0 foreach my $distro (keys %{ $self->{distros} }) {
248 #print "$distro\n";
249 0 ▶ my $name = $distro eq 'mandrake' ? 'mandriva' : $distro;
Branch: 1 branch
BranchTrueFalseTotal
$distro eq 'mandrake' ? : 0 0 0
250  
251 $self->create_file(
252 template => $self->_modules_in_distro_report_tmpl,
253 filename => File::Spec->catfile($self->_dir, 'distros', "$name.html"),
254 params => {
255 distro => ucfirst($name),
256 0 modules => $self->{distros}{$distro},
257 },
258 );
259 }
260 }
261  
262 0 ▶sub _generate_per_author_report {
Subroutine _generate_per_author_report: not called CC=5 SCAR=34.0
263 0 my ($self) = @_;
264  
265 0 foreach my $cpanid (keys %{ $self->{authors} }) {
266 0 my @modules;
267 0 foreach my $module (@{ $self->{authors}{$cpanid}}) {
268 0 my @dists;
269 0 foreach my $d (@distributions) {
270 0 ▶ push @dists, {version => $module->{ $d->{source} } || ''}
Condition0%0/2
$$module{$d->{'source'}} || ''
l!l
00
MC/DC0%0/1
$$module{$d->{'source'}} || ''
$$module{$d->{'source'}}
Truth table0%0/2
A
A= $$module{$d->{'source'}}
Aresult
11
00
271 }
272 push @modules, {
273 name => $module->{name},
274 cpan => $module->{cpan},
275 0 distros => \@dists,
276 };
277 }
278  
279 $self->create_file(
280 0 template => $self->_per_author_report_tmpl,
281 filename => File::Spec->catfile($self->_dir, 'authors', "$cpanid.html"),
282 params => {
283 modules => \@modules,
284 footer => $self->_footer(),
285 cpanid => $cpanid,
286 },
287 );
288 }
289 0 my @cpanids = map {{cpanid => $_}} sort keys %{ $self->{authors} };
290 0 $self->create_file(
291 template => $self->_authors_index_tmpl(),
292 filename => File::Spec->catfile($self->_dir, 'authors', "index.html"),
293 params => {
294 ids => \@cpanids,
295 footer => $self->_footer(),
296 },
297 );
298 }
299  
300 0 ▶sub _generate_report_for_letters {
Subroutine _generate_report_for_letters: not called CC=2 SCAR=17.9
301 0 my ($self) = @_;
302 0 foreach my $letter (@letters) {
303 0 $self->_generate_report_for_letter($letter);
304 }
305 }
306 0 ▶sub _generate_report_for_letter {
Subroutine _generate_report_for_letter: not called CC=5 SCAR=34.0
307 0 my ($self, $letter) = @_;
308  
309 0 my @module_names = grep {/^$letter/i} $self->_list_packages;
310 0 my @modules;
311 0 foreach my $dash_name (@module_names) {
312 0 my @dists;
313 0 my $dists = $self->{p}->check($dash_name);
314 0 my $name = $dash_name;
315 0 $name =~ s/-/::/g;
316 0 foreach my $d (@distributions) {
317 0 ▶ next if not $d->{title};
Branch: 1 branch
BranchTrueFalseTotal
unless $d->{"title"} 0 0 0
318 0 ▶ push @dists, {version => $dists->{ $d->{source} } || ''};
Condition0%0/2
$$dists{$d->{'source'}} || ''
l!l
00
MC/DC0%0/1
$$dists{$d->{'source'}} || ''
$$dists{$d->{'source'}}
Truth table0%0/2
A
A= $$dists{$d->{'source'}}
Aresult
11
00
319 }
320  
321 push @modules, {
322 cpan => $dists->{cpan},
323 0 name => $name,
324 distros => \@dists,
325 };
326 }
327  
328 0 my @distribution_titles = map { {title => $_->{title} } }
329 0 grep { $_->{title} } @distributions;
330  
331 0 $self->create_file(
332 template => $self->_report_tmpl(),
333 filename => File::Spec->catfile($self->_dir, 'letters', "$letter.html"),
334 params => {
335 distributions => \@distribution_titles,
336 modules => \@modules,
337 footer => $self->_footer(),
338 },
339 );
340 }
341 0 ▶sub _generate_missing_reports {
Subroutine _generate_missing_reports: not called CC=2 SCAR=17.9
342 0 my ($self) = @_;
343 0 my @misses = (
344 [
345 'debian_unstable',
346 ['ubuntu_gutsy_main', 'ubuntu_gutsy_universe'],
347 "from_ubuntu.html",
348 "Available in Debian Unstable but missing from Ubuntu Gutsy (or different version)",
349 ],
350 [
351 'freebsd',
352 ['debian_unstable'],
353 "from_debian.html",
354 "Available in FreeBSD but missing from Debian Unstable",
355 ],
356 );
357  
358 0 foreach my $m (@misses) {
359 0 $self->_generate_missing_from(@$m);
360 }
361  
362 0 my @links = map { {title => $_->[3], file => $_->[2]} } @misses;
363  
364 0 $self->create_file(
365 template => $self->_missing_index_tmpl(),
366 filename => File::Spec->catfile($self->_dir, 'missing', "index.html"),
367 params => {
368 footer => $self->_footer(),
369 links => \@links,
370 },
371 );
372 }
373  
374 # List all the modules that are available in Debian unstable and not in Ubuntu Gutsy
375 0 ▶sub _generate_missing_from {
Subroutine _generate_missing_from: not called CC=8 SCAR=42.8
376 0 my ($self, $distro_has, $distro_misses, $filename, $title) = @_;
377 0 my @missing;
378 MODULE:
379 0 foreach my $module (@{ $self->{distros}{$distro_has} }) {
380 0 (my $dash_name = $module->{name}) =~ s/::/-/g;
381 0 my $dists = $self->{p}->check($dash_name);
382 0 foreach my $misses (@$distro_misses) {
383 0 ▶ next MODULE if $dists->{$misses} and $dists->{$misses} eq $dists->{debian_unstable};
Branch: 1 branch
BranchTrueFalseTotal
if $dists->{$misses} and $dists->{$misses} eq $dists->{"debian_unstable"} 0 0 0
Condition0%0/3
$dists->{$misses} and $dists->{$misses} eq $dists->{"debian_unstable"}
!ll&&!rl&&r
000
MC/DC0%0/2
$dists->{$misses} and $dists->{$misses} eq $dists->{"debian_unstable"}
$dists->{$misses} $dists->{$misses} eq $dists->{"debian_unstable"}
Truth table0%0/3
A and B
A= $dists->{$misses}B= $dists->{$misses} eq $dists->{"debian_unstable"}
ABresult
0X0
100
111
384 }
385 0 my $cpanid = '';
386 0 ▶ if (my $m = $self->{pcp}->package($module->{name})) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $m = $self->{'pcp'}->package($module->{'name'})) { } 0 0 0
387 0 ▶ if (my $d = $m->distribution) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $d = $m->distribution) 0 0 0
388 0 $cpanid = uc($d->cpanid);
389 }
390 } else {
391 0 warn "'$module->{name}' has no author!\n";
392 }
393
394 push @missing, {
395 name => $module->{name},
396 0 ▶ url => ($cpanid ? "../authors/$cpanid.html" : ''),
Branch: 1 branch
BranchTrueFalseTotal
$cpanid ? : 0 0 0
397 };
398 }
399 $self->create_file(
400 0 template => $self->_missing_modules_tmpl(),
401 filename => File::Spec->catfile($self->_dir, 'missing', $filename),
402 params => {
403 title => $title,
404 modules => \@missing,
405 footer => $self->_footer(),
406 },
407 );
408  
409  
410 }
411  
412 0 ▶sub create_file {
Subroutine create_file: not called CC=2 SCAR=17.9
Pod undocumented
413 0 my ($self, %args) = @_;
414  
415 0 my $t = HTML::Template->new_scalar_ref(\$args{template}, die_on_bad_params => 1);
416 0 $t->param(%{ $args{params} });
417 0 ▶ open my $fh, '>', $args{filename} or die "Could not open '$args{filename}' $!";
Branch: 1 branch
BranchTrueFalseTotal
open my $fh, ">", $args{"filename"} or die qq[Could not open '$args{"filename"}' $!] 0 0 0
418 0 print {$fh} $t->output;
419 }
420  
421 0 ▶sub _footer {
Subroutine _footer: not called CC=1 SCAR=6.9
422 0 my ($self) = @_;
423
424 0 my $template = $self->_footer_tmpl();
425 0 my $t = HTML::Template->new_scalar_ref(\$template, die_on_bad_params => 1);
426 0 $t->param(timestamp => $self->_timestamp);
427 0 $t->param(mp_version => $Module::Packaged::VERSION);
428 0 $t->param(mpr_version => $VERSION);
429 0 return $t->output;
430 }
431  
432
433 0 ▶sub _dir {
Subroutine _dir: not called CC=2 SCAR=17.9
434 0 my ($self) = @_;
435 0 ▶ return $self->{opts}{dir} || './report';
Condition0%0/2
$self->{'opts'}{'dir'} || './report'
l!l
00
MC/DC0%0/1
$self->{'opts'}{'dir'} || './report'
$self->{'opts'}{'dir'}
Truth table0%0/2
A
A= $self->{'opts'}{'dir'}
Aresult
11
00
436 }
437  
438  
439 0 ▶sub usage {
Subroutine usage: not called CC=1 SCAR=6.9
Pod undocumented
440 0 print <<"USAGE";
441 Usage: $0
442 --test test run using small number of modules
443 --real real run
444 You have to provide either test or real
445  
446 --dir DIR name of the directory where the reports are generated (defaults to ./report)
447  
448 --help this help
449 USAGE
450  
451 0 exit;
452 }
453  
454  
455  
456 ############################### Templates ########################
457 # for the time we might generate the column titles
458 #<tr>
459 # <td></td>
460 # <TMPL_LOOP packagers>
461 # <td><TMPL_VAR name></td>
462 # </TMPL_LOOP>
463 #</tr>
464  
465 0 ▶sub _save_style {
Subroutine _save_style: not called CC=2 SCAR=17.9
466 0 my ($self) = @_;
467  
468 0 my $filename = File::Spec->catfile($self->_dir, "style.css");
469 0 ▶ open my $fh, '>', $filename or die $!;
Branch: 1 branch
BranchTrueFalseTotal
open my $fh, ">", $filename or die $! 0 0 0
470 0 print {$fh} <<'END_CSS';
471 <style type="text/css">
472
473 first_one_is_not_seen_by_firefox {
474 }
475
476 h1 {
477 color: #000000;
478 text-align: center;
479 }
480
481 body {
482 background-color: #FFFFFF;
483 font-size: 12px;
484 }
485 table {
486 border-width: 1px;
487 border-style: solid;
488 }
489 td {
490 border-width: 1px;
491 border-style: solid;
492 text-align: center;
493 font-size: 12px;
494 }
495  
496 .internal {
497 border-style: none;
498 }
499  
500 .name {
501 text-align: left;
502 }
503 </style>
504  
505 END_CSS
506  
507 }
508  
509 0 ▶sub _authors_index_tmpl {
Subroutine _authors_index_tmpl: not called CC=1 SCAR=6.9
510 0 return <<'END_TMPL';
511 <html>
512 <head>
513 <title>CPAN Modules in Distributions per author</title>
514 <link rel="stylesheet" type="text/css" href="../style.css" />
515 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
516 <meta http-equiv="Content-Style-Type" content="text/css" />
517 </head>
518 <body>
519 <center><h1>CPAN Modules in Distributions per author</h1></center>
520 <p>
521 <a href="../index.html">index</a>
522 <p>
523 <TMPL_LOOP ids>
524 <a href="<TMPL_VAR cpanid>.html"><TMPL_VAR cpanid></a><br />
525 </TMPL_LOOP>
526 <TMPL_VAR footer>
527 </body>
528 </html>
529 END_TMPL
530  
531 }
532 0 ▶sub _index_tmpl {
Subroutine _index_tmpl: not called CC=1 SCAR=6.9
533 0 return <<'END_TMPL';
534 <html>
535 <head>
536 <title>CPAN Modules in Distributions</title>
537 <link rel="stylesheet" type="text/css" href="style.css" />
538 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
539 <meta http-equiv="Content-Style-Type" content="text/css" />
540 </head>
541 <body>
542 <center><h1>CPAN Modules in Distributions</h1></center>
543 Modules starting with letter
544 <TMPL_LOOP letters>
545 <a href="letters/<TMPL_VAR letter>.html"><TMPL_VAR letter></a>&nbsp;
546 </TMPL_LOOP>
547 <p>
548 <a href="authors/">Authors</a>
549 <p>
550 <a href="missing/">Missing reports</a>
551 <p>
552 Total number of modules in each distribution:
553 <table>
554 <tr><td class="name">CPAN</td><td><TMPL_VAR cpan></td></tr>
555 <TMPL_LOOP distros>
556 <tr><td class="name"><TMPL_VAR title></td><td><a href="distros/<TMPL_VAR name>.html"><TMPL_VAR count></a></td></tr>
557 </TMPL_LOOP>
558 </table>
559  
560 <p>
561 Wishes:
562 <ul>
563 <li>Include <strike>Ubuntu</strike>, RedHat, <strike>Gentoo</strike>, Sun Solaris, AIX, HP-UNIX etc</li>
564 <li><strike>Separate Debian stable and testing</strike></li>
565 <li>At least in Ubuntu separate the report for standard, universe and backport repositories</li>
566 <li><strike>Include ActiveState distributions</strike></li>
567 <li>Include ActiveState distributions for older Perl versions</li>
568 </ul>
569 </p>
570  
571 <TMPL_VAR footer>
572 </body>
573 </html>
574 END_TMPL
575  
576 }
577  
578 0 ▶sub _modules_in_distro_report_tmpl {
Subroutine _modules_in_distro_report_tmpl: not called CC=1 SCAR=6.9
579 0 return <<'END_TMPL';
580 <html>
581 <head>
582 <title>CPAN Modules in <TMPL_VAR distro></title>
583 <link rel="stylesheet" type="text/css" href="../style.css" />
584 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
585 <meta http-equiv="Content-Style-Type" content="text/css" />
586 </head>
587 <body>
588 <h1>CPAN Modules in <TMPL_VAR distro></h1>
589 <a href="../index.html">index</a>
590 <table>
591 <tr><td>Name</td>
592 <td>Version</td>
593 <td>Latest on CPAN</td>
594 <TMPL_LOOP modules><tr><td class="name"><TMPL_VAR name></td><td><TMPL_VAR version></td><td><TMPL_VAR cpan></td></tr>
595 </TMPL_LOOP>
596 </table>
597  
598 <TMPL_VAR footer>
599  
600 </body>
601 </html>
602 END_TMPL
603  
604 }
605  
606 0 ▶sub _per_author_report_tmpl {
Subroutine _per_author_report_tmpl: not called CC=1 SCAR=6.9
607 0 return <<'END_TMPL';
608 <html>
609 <head>
610 <title>CPAN Modules of <TMPL_VAR cpanid> in Distributions</title>
611 <link rel="stylesheet" type="text/css" href="../style.css" />
612 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
613 <meta http-equiv="Content-Style-Type" content="text/css" />
614 </head>
615 <body>
616 <h1>CPAN Modules of <TMPL_VAR cpanid> in Distributions</h1>
617 <a href="../index.html">index</a>
618 <table>
619 <tr><td rowspan="2"></td>
620 <td rowspan="2">CPAN</td>
621  
622 <td colspan="3">Debian</td>
623 <td colspan="11">Ubuntu</td>
624  
625 <td rowspan="2">Fedora</td>
626 <td rowspan="2">FreeBSD</td>
627 <td rowspan="2">Mandriva</td>
628 <td rowspan="2">OpenBSD</td>
629 <td rowspan="2">Suse</td>
630 <td rowspan="2">Gentoo</td>
631  
632 <td colspan="5">ActivePerl 8xx</td>
633 </tr>
634  
635 <tr>
636 <td class="internal">Testing</td>
637 <td class="internal">Unstable</td>
638 <td class="internal">Stable</td>
639  
640 <td class="internal">Gutsy Gibbon 7.10 main</td>
641 <td class="internal">Gutsy Gibbon 7.10 universe</td>
642 <td class="internal">Feisty Fawn 7.04 main</td>
643 <td class="internal">Feisty Fawn 7.04 universe</td>
644 <td class="internal">Edgy Eft 6.10 main</td>
645 <td class="internal">Edgy Eft 6.10 universe</td>
646 <td class="internal">Dapper Drake 6.06 main</td>
647 <td class="internal">Dapper Drake 6.06 universe</td>
648 <td class="internal">Breezy Badger 5.10</td>
649 <td class="internal">Hoary Hedgehog 5.04</td>
650 <td class="internal">Warty Warthog 4.10</td>
651  
652 <td class="internal">Windows</td>
653 <td class="internal">Solaris</td>
654 <td class="internal">Linux</td>
655 <td class="internal">HP-UX</td>
656 <td class="internal">Darwin</td>
657 </tr>
658 <TMPL_LOOP modules>
659 <tr>
660 <td class="name"><TMPL_VAR name></td>
661 <td><TMPL_VAR cpan></td>
662 <TMPL_LOOP distros>
663 <td><TMPL_VAR version></td>
664 </TMPL_LOOP>
665 </tr>
666 </TMPL_LOOP>
667 </table>
668  
669 <TMPL_VAR footer>
670  
671 </body>
672 </html>
673 END_TMPL
674  
675 }
676  
677  
678 0 ▶sub _report_tmpl {
Subroutine _report_tmpl: not called CC=1 SCAR=6.9
679 0 return <<'END_TMPL';
680 <html>
681 <head>
682 <title>CPAN Modules in Distributions</title>
683 <link rel="stylesheet" type="text/css" href="../style.css" />
684 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
685 <meta http-equiv="Content-Style-Type" content="text/css" />
686 </head>
687 <body>
688 <h1>CPAN Modules in Distributions</h1>
689 <a href="../index.html">index</a>
690 <table>
691 <tr><td></td>
692 <td>CPAN</td>
693 <TMPL_LOOP distributions>
694 <td><TMPL_VAR title></td>
695 </TMPL_LOOP>
696 <TMPL_LOOP modules>
697  
698 <tr>
699 <td class="name"><TMPL_VAR name></td>
700 <td><TMPL_VAR cpan></td>
701 <TMPL_LOOP distros>
702 <td><TMPL_VAR version></td>
703 </TMPL_LOOP>
704 </tr>
705  
706 </TMPL_LOOP>
707 </table>
708  
709 <TMPL_VAR footer>
710  
711 </body>
712 </html>
713 END_TMPL
714  
715 }
716  
717 0 ▶sub _footer_tmpl {
Subroutine _footer_tmpl: not called CC=1 SCAR=6.9
718 0 return <<'END_TMPL';
719 <p>
720 Report generated on <TMPL_VAR timestamp>
721 using <a href="http://search.cpan.org/dist/Module-Packaged-Report">Module::Packaged::Report</a>
722 version <TMPL_VAR mpr_version>
723 and <a href="http://search.cpan.org/dist/Module-Packaged">Module::Packaged</a> version <TMPL_VAR mp_version>.
724 Patches to both modules are welcome by the respective authors. Subversion repository of
725 <a href="http://svn1.hostlocal.com/szabgab/trunk/Module-Packaged-Report/">Module-Packaged-Report</a>
726 and the Subversion repository of the patched version of
727 <a href="http://svn1.hostlocal.com/szabgab/trunk/Module-Packaged-0.86/">Module-Packaged</a> where you
728 can see how the data is being collected.
729 </p>
730 END_TMPL
731  
732 }
733  
734 0 ▶sub _missing_index_tmpl {
Subroutine _missing_index_tmpl: not called CC=1 SCAR=6.9
735 0 return <<'END_TMPL';
736 <html>
737 <head>
738 <title>CPAN Modules in Distributions - Missing reports</title>
739 <link rel="stylesheet" type="text/css" href="../style.css" />
740 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
741 <meta http-equiv="Content-Style-Type" content="text/css" />
742 </head>
743 <body>
744 <center><h1>CPAN Modules in Distributions - missing reports</h1></center>
745 <p>
746 <a href="../index.html">index</a>
747 <p>
748 <i>"Missing file cannot be found"</i>
749 </p>
750 <p>
751 <TMPL_LOOP links>
752 <a href="<TMPL_VAR file>"><TMPL_VAR title></a><br />
753 </TMPL_LOOP>
754 </p>
755 <TMPL_VAR footer>
756 </body>
757 </html>
758 END_TMPL
759  
760 }
761  
762 0 ▶sub _missing_modules_tmpl {
Subroutine _missing_modules_tmpl: not called CC=1 SCAR=6.9
763 0 return <<'END_TMPL';
764 <html>
765 <head>
766 <title><TMPL_VAR title></title>
767 <link rel="stylesheet" type="text/css" href="../style.css" />
768 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
769 <meta http-equiv="Content-Style-Type" content="text/css" />
770 </head>
771 <body>
772 <center><h1><TMPL_VAR title></h1></center>
773 <p>
774 <a href="../index.html">index</a>
775 <p>
776 <i>"Missing file cannot be found"</i>
777 </p>
778 <p>
779 <ul>
780 <TMPL_LOOP modules>
781 <TMPL_IF url>
782 <li><a href="<TMPL_VAR url>"><TMPL_VAR name></a></li>
783 <TMPL_ELSE>
784 <li><TMPL_VAR name></li>
785 </TMPL_IF>
786 </TMPL_LOOP>
787 </ul>
788 </p>
789 <TMPL_VAR footer>
790 </body>
791 </html>
792 END_TMPL
793  
794 }
795  
796  
797 =head1 NAME
798  
799 Module::Packaged::Report - Generate report upon packages of CPAN distributions
800  
801 =head1 SYNOPSIS
802  
803 Run the create_package_report.pl script that comes with the module.
804  
805 =head1 DESCRIPTION
806  
807 Using L<Module::Packaged> to fetch the collected data.
808  
809 Create table of CPAN modules vs. Distributions (e.g. Linux distributions, Solaris compiled packages etc)
810 that will show for each module and distro which version (if any) of the CPAN module is available
811 for that distro in it standard packaging system.
812  
813 =head1 METHODS
814  
815 =head2 new
816  
817 my $mpr = Module::Packaged::Report->new(%OPTIONS);
818  
819 %OPTIONS can be
820  
821 test => 1 or real => 1
822  
823 help => 1 to get help
824  
825 dir => /path/to/dir
826  
827
828 =head2 generate_html_report;
829  
830 $mpr->generate_html_report;
831  
832  
833 =head1 TODO
834  
835 Add more distributions.
836  
837 Coloring, so it will be obvious which distribution carries the latest version and
838 which one has a huge? gap.
839  
840 Explain this!
841 Total number of modules on cpan is reported as 12422 while www.cpan.org reports 11563.
842  
843 Generate SQLite database of all the raw data to be queried?
844  
845 =head1 See also
846  
847 L<Module::Packaged> and L<Module::Packaged::Generate>
848  
849 L<Parse::Debian::Packages> L<Debian::Package::HTML>
850  
851 =head1 COPYRIGHT
852  
853 Copyright (c) 2007 Gabor Szabo. All rights reserved. This program is
854 free software; you can redistribute it and/or modify it under the same
855 terms as Perl itself.
856  
857 =head1 AUTHOR
858  
859 Gabor Szabo <gabor@pti.co.il>
860  
861 =cut
862  
863 1 1;
864  
865  
↑ Summary script/create_package_report.pl »