lib/CPAN/MirrorStatus.pm

filter: Statementstmt 58.8% 20 / 34 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 63.6% 7 / 11 Podpod n/a totaltotal 57.4% 27 / 47 CC 3 SCAR 13.3
CC
3
Cov
56%
new
12.0
query
2.0
render
2.0
CRAP 3.8
↑ Summary
1 package CPAN::MirrorStatus;
2 our $VERSION = '0.02_01';
3  
4 # ABSTRACT: query mirrors status from mirrors.cpan.org
5  
6 1 ▶use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 1 ▶use LWP::Simple;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 ▶use Rubyish::Attribute;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 ▶use self;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=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 0 ▶sub new {
Subroutine new: not called CC=3 SCAR=24.8
28 0 my ($class,$args) = @_;
29 0 my $self = bless {}, $class;
30 0 for (@attr) {
31 0 ▶ $self->{$_} = $args->{$_} ? $args->{$_} : $default->{$_};
Branch: 1 branch
BranchTrueFalseTotal
$args->{$_} ? : 0 0 0
32 }
33 }
34  
35 0 ▶sub query {
Subroutine query: not called CC=1 SCAR=6.9
36
37 }
38  
39 0 ▶sub render {
Subroutine render: not called CC=1 SCAR=6.9
40 0 my ($format) = @args;
41 0 given ($format) {
42 0 when ("widget") { render_widget() }
43 0 when ("json") { render_json() }
44 }
45 }
46  
47 0 ▶sub render_json {
Subroutine render_json: not called CC=1 SCAR=6.9
48  
49 }
50  
51 sub render_widget
52  
53  
54 1;
55  
56  
57  
58 __END__
↑ Summary