line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package CPANPLUS::Shell::Default::Plugins::RT; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
2283
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
44
|
|
4
|
1
|
|
|
1
|
|
3442
|
use LWP::Simple qw[get]; |
|
1
|
|
|
|
|
88523
|
|
|
1
|
|
|
|
|
10
|
|
5
|
1
|
|
|
1
|
|
1320
|
use Data::Dumper; |
|
1
|
|
|
|
|
12587
|
|
|
1
|
|
|
|
|
68
|
|
6
|
1
|
|
|
1
|
|
847
|
use Params::Check qw[check]; |
|
1
|
|
|
|
|
5092
|
|
|
1
|
|
|
|
|
92
|
|
7
|
1
|
|
|
1
|
|
1043
|
use CPANPLUS::Error qw[error msg]; |
|
1
|
|
|
|
|
29691
|
|
|
1
|
|
|
|
|
70
|
|
8
|
1
|
|
|
1
|
|
10
|
use Locale::Maketext::Simple Class => 'CPANPLUS', Style => 'gettext'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
399
|
use vars qw[$VERSION]; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
650
|
|
11
|
|
|
|
|
|
|
$VERSION = '0.01'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
my $ListUri = 'http://rt.cpan.org/NoAuth/bugs.tsv?Dist='; |
14
|
|
|
|
|
|
|
my $ShowUri = 'http://rt.cpan.org/NoAuth/Bugs.html?Dist='; |
15
|
|
|
|
|
|
|
my $Format = " [%6d] [%4s] %s\n"; |
16
|
|
|
|
|
|
|
my $Address = "bug-%s\@rt.cpan.org"; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
local $Data::Dumper::Indent = 1; |
19
|
|
|
|
|
|
|
|
20
|
1
|
|
|
1
|
0
|
1450
|
sub plugins { ( rt => 'rt' ) } |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub rt { |
23
|
0
|
|
|
0
|
0
|
|
my $class = shift; |
24
|
0
|
|
|
|
|
|
my $shell = shift; |
25
|
0
|
|
|
|
|
|
my $cb = shift; |
26
|
0
|
|
|
|
|
|
my $cmd = shift; |
27
|
0
|
|
0
|
|
|
|
my $input = shift || ''; |
28
|
0
|
|
0
|
|
|
|
my $opts = shift || {}; |
29
|
|
|
|
|
|
|
|
30
|
0
|
|
|
|
|
|
my $report; |
31
|
0
|
|
|
|
|
|
my $tmpl = { |
32
|
|
|
|
|
|
|
report => { default => 0, store => \$report }, |
33
|
|
|
|
|
|
|
}; |
34
|
|
|
|
|
|
|
|
35
|
0
|
0
|
|
|
|
|
check( $tmpl, $opts ) or ( |
36
|
|
|
|
|
|
|
error( Params::Check->last_error ), |
37
|
|
|
|
|
|
|
return |
38
|
|
|
|
|
|
|
); |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
### no input? wrong usage, show help |
41
|
0
|
0
|
|
|
|
|
if ( not length $input ) { |
42
|
0
|
|
|
|
|
|
print __PACKAGE__->rt_help; |
43
|
0
|
|
|
|
|
|
return; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
### find the first module in the list |
47
|
|
|
|
|
|
|
### also gets rid of trailing whitespace |
48
|
0
|
|
|
|
|
|
my @list = split /\s+/, $input; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
### multiple entries not supported (yet) |
51
|
0
|
0
|
|
|
|
|
if( @list > 1 ) { |
52
|
0
|
|
|
|
|
|
error(loc("Viewing multiple distributions at once is not supported")); |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
### use the frontmost instead |
56
|
0
|
|
|
|
|
|
my $try = $list[0]; |
57
|
|
|
|
|
|
|
|
58
|
0
|
0
|
|
|
|
|
if( $try =~ /^\d+$/ ) { |
59
|
0
|
|
|
|
|
|
error(loc("Viewing tickets not yet supported")); |
60
|
0
|
|
|
|
|
|
return; |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
### fetching by name or reporting... |
63
|
|
|
|
|
|
|
} else { |
64
|
|
|
|
|
|
|
|
65
|
0
|
0
|
|
|
|
|
my $mod = $cb->module_tree( $try ) or ( |
66
|
|
|
|
|
|
|
error(loc("Could not find '%1' in the module tree", $try )), |
67
|
|
|
|
|
|
|
return |
68
|
|
|
|
|
|
|
); |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
### the package this module is in |
71
|
0
|
|
|
|
|
|
my $dist = $mod->package_name; |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
### not reporting, just display the list |
74
|
0
|
0
|
|
|
|
|
unless( $report ) { |
75
|
0
|
|
|
|
|
|
my $url = $ListUri . $dist; |
76
|
|
|
|
|
|
|
|
77
|
0
|
|
|
|
|
|
msg(loc("Fetching bug list for '%1' from '%2'", $dist, $url )); |
78
|
|
|
|
|
|
|
|
79
|
0
|
|
|
|
|
|
my $content = get( $url ); |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
### some error occurred |
82
|
0
|
0
|
|
|
|
|
unless( defined $content ) { |
83
|
0
|
|
|
|
|
|
error(loc("Failed to fetch content from '%1'", $url)); |
84
|
0
|
|
|
|
|
|
return; |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
### no bugs reported |
88
|
0
|
0
|
|
|
|
|
if( not length $content ) { |
89
|
0
|
|
|
|
|
|
print "\n", loc("No bugs reported for '%1'", $dist); |
90
|
0
|
|
|
|
|
|
print "\n\n"; |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
### list the bugs |
93
|
|
|
|
|
|
|
} else { |
94
|
0
|
|
|
|
|
|
print "\n", loc("Bug list for '%1':", $dist), "\n\n"; |
95
|
|
|
|
|
|
|
|
96
|
0
|
|
|
|
|
|
my @list = |
97
|
0
|
|
|
|
|
|
sort { $a->[1] <=> $b->[1] } |
98
|
0
|
|
|
|
|
|
map { [ /^\s*(\S+)\s+(\d+)\s+(.+?)\s+(\w+)\s*$/ ] } |
99
|
|
|
|
|
|
|
split /\n/, $content; |
100
|
|
|
|
|
|
|
|
101
|
0
|
|
|
|
|
|
for my $aref ( @list ) { |
102
|
0
|
|
|
|
|
|
my( $link, $id, $topic, $status ) = @$aref; |
103
|
|
|
|
|
|
|
|
104
|
0
|
|
|
|
|
|
printf $Format, $id, $status, $topic; |
105
|
|
|
|
|
|
|
} |
106
|
|
|
|
|
|
|
|
107
|
0
|
|
|
|
|
|
print "\n\n Web Url: $ShowUri$dist\n\n"; |
108
|
|
|
|
|
|
|
} |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
} else { |
111
|
|
|
|
|
|
|
|
112
|
0
|
|
|
|
|
|
error(loc("Submitting reports not yet supported")); |
113
|
0
|
|
|
|
|
|
return; |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
} |
116
|
|
|
|
|
|
|
} |
117
|
|
|
|
|
|
|
} |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
sub rt_help { |
120
|
0
|
|
|
0
|
0
|
|
return loc( |
121
|
|
|
|
|
|
|
" /rt Module::Name\n" . |
122
|
|
|
|
|
|
|
" Retrieves the open bug reports for this module from rt.cpan.org\n". |
123
|
|
|
|
|
|
|
" Viewing a specific bug ticket and reporting a bug are not yet\n" . |
124
|
|
|
|
|
|
|
" supported, but will be in the future\n" |
125
|
|
|
|
|
|
|
); |
126
|
|
|
|
|
|
|
} |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
1; |