line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package CPAN::MirrorStatus; |
2
|
|
|
|
|
|
|
our $VERSION = '0.02_01'; |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
# ABSTRACT: query mirrors status from mirrors.cpan.org |
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
37921
|
use 5.010; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
47
|
|
7
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
54
|
|
8
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
41
|
|
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
1091
|
use LWP::Simple; |
|
1
|
|
|
|
|
122396
|
|
|
1
|
|
|
|
|
10
|
|
11
|
1
|
|
|
1
|
|
1366
|
use Rubyish::Attribute; |
|
1
|
|
|
|
|
5752
|
|
|
1
|
|
|
|
|
7
|
|
12
|
1
|
|
|
1
|
|
8391
|
use self; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
# configurable attributions |
15
|
|
|
|
|
|
|
# each attribution would be setted in constructor |
16
|
|
|
|
|
|
|
my @attr = qw(catch location target); |
17
|
|
|
|
|
|
|
my $default = { |
18
|
|
|
|
|
|
|
catch => "60", |
19
|
|
|
|
|
|
|
location => "/tmp/cpan-mirrorstatus.tmp", |
20
|
|
|
|
|
|
|
target => "cpan.nctu.edu.tw", |
21
|
|
|
|
|
|
|
}; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
# define setter of configurable attribution |
24
|
|
|
|
|
|
|
attr_accessor @attr; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub new { |
28
|
|
|
|
|
|
|
my ($class,$args) = @_; |
29
|
|
|
|
|
|
|
my $self = bless {}, $class; |
30
|
|
|
|
|
|
|
for (@attr) { |
31
|
|
|
|
|
|
|
$self->{$_} = $args->{$_} ? $args->{$_} : $default->{$_}; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub query { |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub render { |
40
|
|
|
|
|
|
|
my ($format) = @args; |
41
|
|
|
|
|
|
|
given ($format) { |
42
|
|
|
|
|
|
|
when ("widget") { render_widget() } |
43
|
|
|
|
|
|
|
when ("json") { render_json() } |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub render_json { |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub render_widget |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
1; |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
__END__ |