line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Module::Packaged; |
2
|
1
|
|
|
1
|
|
1079
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
52
|
|
3
|
1
|
|
|
1
|
|
9304
|
use App::Cache; |
|
1
|
|
|
|
|
348426
|
|
|
1
|
|
|
|
|
12
|
|
4
|
1
|
|
|
1
|
|
5687
|
use Compress::Zlib; |
|
1
|
|
|
|
|
186498
|
|
|
1
|
|
|
|
|
822
|
|
5
|
1
|
|
|
1
|
|
2282
|
use LWP::Simple; |
|
1
|
|
|
|
|
145660
|
|
|
1
|
|
|
|
|
14
|
|
6
|
1
|
|
|
1
|
|
510
|
use Storable qw(thaw); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
59
|
|
7
|
1
|
|
|
1
|
|
6
|
use vars qw($VERSION); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
223
|
|
8
|
|
|
|
|
|
|
$VERSION = '0.86'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub new { |
11
|
1
|
|
|
1
|
1
|
427
|
my $class = shift; |
12
|
1
|
|
|
|
|
2
|
my $self = {}; |
13
|
1
|
|
|
|
|
3
|
bless $self, $class; |
14
|
|
|
|
|
|
|
|
15
|
1
|
|
|
|
|
12
|
my $cache = App::Cache->new({ ttl => 60 * 60 }); |
16
|
1
|
|
|
|
|
1022
|
my $data = $cache->get_url('http://www.astray.com/tmp/module_packaged.gz'); |
17
|
0
|
|
|
|
|
|
$self->{data} = thaw(uncompress($data)); |
18
|
0
|
|
|
|
|
|
return $self; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub check { |
22
|
0
|
|
|
0
|
1
|
|
my ($self, $dist) = @_; |
23
|
0
|
|
|
|
|
|
return $self->{data}->{$dist}; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
1; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
__END__ |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head1 NAME |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
Module::Packaged - Report upon packages of CPAN distributions |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head1 SYNOPSIS |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
use Module::Packaged; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
my $p = Module::Packaged->new(); |
39
|
|
|
|
|
|
|
my $dists = $p->check('Archive-Tar'); |
40
|
|
|
|
|
|
|
# $dists is now: |
41
|
|
|
|
|
|
|
# { |
42
|
|
|
|
|
|
|
# cpan => '1.08', |
43
|
|
|
|
|
|
|
# debian => '1.03', |
44
|
|
|
|
|
|
|
# fedora => '0.22', |
45
|
|
|
|
|
|
|
# freebsd => '1.07', |
46
|
|
|
|
|
|
|
# gentoo => '1.05', |
47
|
|
|
|
|
|
|
# openbsd => '0.22', |
48
|
|
|
|
|
|
|
# suse => '0.23', |
49
|
|
|
|
|
|
|
# } |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
# meaning that Archive-Tar is at version 1.08 on CPAN but only at |
52
|
|
|
|
|
|
|
# version 1.07 on FreeBSD, version 1.05 on Gentoo, version 1.03 on |
53
|
|
|
|
|
|
|
# Debian, version 0.23 on SUSE and version 0.22 on OpenBSD |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head1 DESCRIPTION |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
CPAN consists of distributions. However, CPAN is not an isolated |
58
|
|
|
|
|
|
|
system - distributions are also packaged in other places, such as for |
59
|
|
|
|
|
|
|
operating systems. This module reports whether CPAN distributions are |
60
|
|
|
|
|
|
|
packaged for various operating systems, and which version they have. |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
Only CPAN, Debian, Fedora (Core 2), FreeBSD, Gentoo, Mandriva (10.1), |
63
|
|
|
|
|
|
|
OpenBSD (3.6) and SUSE (9.2) are currently supported. I want to support |
64
|
|
|
|
|
|
|
everything else. Patches are welcome. |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
The data is fetched from the net and cached for an hour. |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 METHODS |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head2 new() |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
The new() method is a constructor: |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
my $p = Module::Packaged->new(); |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head2 check() |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
The check() method returns a hash reference. The keys are various |
79
|
|
|
|
|
|
|
distributions, the values the version number included: |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
my $dists = $p->check('Archive-Tar'); |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head1 COPYRIGHT |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
Copyright (c) 2003-5 Leon Brocard. All rights reserved. This program is |
86
|
|
|
|
|
|
|
free software; you can redistribute it and/or modify it under the same |
87
|
|
|
|
|
|
|
terms as Perl itself. |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head1 AUTHOR |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
Leon Brocard, leon@astray.com |
92
|
|
|
|
|
|
|
|