line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MyCPAN::Indexer::Interface::ShowDist; |
2
|
1
|
|
|
1
|
|
1261
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
38
|
|
3
|
1
|
|
|
1
|
|
95
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
31
|
|
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
6
|
use Log::Log4perl; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
7
|
|
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
44
|
use parent qw(MyCPAN::Indexer::Component); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
8
|
1
|
|
|
1
|
|
73
|
use vars qw($VERSION $logger); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
95
|
|
9
|
|
|
|
|
|
|
$VERSION = '1.28_12'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 NAME |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
MyCPAN::Indexer::Interface::ShowDist - Show dists as MyCPAN processes them |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 SYNOPSIS |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
Use this in backpan_indexer.pl by specifying it as the interface class: |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# in backpan_indexer.config |
20
|
|
|
|
|
|
|
interface_class MyCPAN::Indexer::Interface::ShowDist |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 DESCRIPTION |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
This class presents the information as the indexer runs, using plain text. |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head2 Methods |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=over 4 |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=cut |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
BEGIN { |
33
|
1
|
|
|
1
|
|
6
|
$logger = Log::Log4perl->get_logger( 'Interface' ); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=item component_type |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
This is an interface type |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=cut |
41
|
|
|
|
|
|
|
|
42
|
0
|
|
|
0
|
1
|
|
sub component_type { $_[0]->interface_type } |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=item do_interface() |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=cut |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub do_interface |
50
|
|
|
|
|
|
|
{ |
51
|
0
|
|
|
0
|
1
|
|
my( $self ) = @_; |
52
|
0
|
|
|
|
|
|
$logger->debug( "Calling do_interface" ); |
53
|
|
|
|
|
|
|
|
54
|
0
|
|
|
|
|
|
my $config = $self->get_config; |
55
|
|
|
|
|
|
|
|
56
|
0
|
|
|
|
|
|
my $indexer = $self->get_coordinator->get_component( 'indexer' ); |
57
|
|
|
|
|
|
|
|
58
|
0
|
|
|
|
|
|
print join( " ", |
59
|
|
|
|
|
|
|
$config->indexer_class, |
60
|
|
|
|
|
|
|
$indexer->VERSION |
61
|
|
|
|
|
|
|
), |
62
|
|
|
|
|
|
|
"\n"; |
63
|
|
|
|
|
|
|
|
64
|
0
|
|
|
|
|
|
my $total = @{ $self->get_note('queue') }; |
|
0
|
|
|
|
|
|
|
65
|
0
|
|
0
|
|
|
|
my $width = eval { int( log($total)/log(10) + 1 ) } || 5; |
66
|
0
|
|
|
|
|
|
print "Processing $total distributions\n"; |
67
|
|
|
|
|
|
|
|
68
|
0
|
|
|
|
|
|
my $count = 0; |
69
|
0
|
|
|
|
|
|
while( 1 ) |
70
|
|
|
|
|
|
|
{ |
71
|
0
|
0
|
|
|
|
|
last if $self->get_note('Finished'); |
72
|
|
|
|
|
|
|
|
73
|
0
|
|
|
|
|
|
local $| = 1; |
74
|
|
|
|
|
|
|
|
75
|
0
|
|
|
|
|
|
my $info = $self->get_note('interface_callback')->(); |
76
|
0
|
|
|
|
|
|
my $status = do { |
77
|
0
|
0
|
|
|
|
|
if( exists $info->{skipped} ) { 'skipped' } |
|
0
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
78
|
0
|
|
|
|
|
|
elsif( exists $info->{skip_error} ) { 'previous error (skipped)' } |
79
|
0
|
|
|
|
|
|
elsif( exists $info->{run_info}{error} ) { $self->get_error($info) } |
80
|
0
|
|
|
|
|
|
elsif( exists $info->{run_info}{completed} ) { 'completed' } |
81
|
0
|
|
|
|
|
|
else { 'unknown' } |
82
|
|
|
|
|
|
|
}; |
83
|
|
|
|
|
|
|
|
84
|
0
|
|
0
|
|
|
|
printf "[%*d/%d] %s ---> %s\n", $width, ++$count, $total, |
85
|
|
|
|
|
|
|
$info->{dist_info}{dist_basename} || '(unknown dist???)', |
86
|
|
|
|
|
|
|
$status; |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
0
|
|
|
|
|
|
my $collator = $self->get_coordinator->get_note( 'collator' ); |
90
|
0
|
|
|
|
|
|
$collator->(); |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
BEGIN { |
94
|
1
|
|
|
1
|
|
644
|
my @patterns = ( |
95
|
|
|
|
|
|
|
qr/Malformed UTF-8/p, |
96
|
|
|
|
|
|
|
qr/No child process/p, |
97
|
|
|
|
|
|
|
qr/Alarm rang/p, |
98
|
|
|
|
|
|
|
); |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=item get_error |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
Returns the error message that most likely was the big problem. |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=cut |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
sub get_error |
107
|
|
|
|
|
|
|
{ |
108
|
0
|
|
|
0
|
1
|
|
my( $self, $info ) = @_; |
109
|
|
|
|
|
|
|
|
110
|
0
|
|
|
|
|
|
my $r = $info->{run_info}; |
111
|
|
|
|
|
|
|
|
112
|
0
|
0
|
|
|
|
|
my @errors = map { $r->{$_} || () } qw(error fatal_error); |
|
0
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
|
114
|
0
|
|
|
|
|
|
foreach my $pattern ( @patterns ) |
115
|
|
|
|
|
|
|
{ |
116
|
0
|
0
|
|
|
|
|
return ${^MATCH} if $errors[0] =~ m/$pattern/p; |
117
|
|
|
|
|
|
|
} |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
} |
120
|
|
|
|
|
|
|
} |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=back |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=head1 SEE ALSO |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
MyCPAN::Indexer |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=head1 SOURCE AVAILABILITY |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
This code is in Github: |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
git://github.com/briandfoy/mycpan-indexer.git |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=head1 AUTHOR |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
brian d foy, C<< >> |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
Copyright (c) 2010-2013, brian d foy, All Rights Reserved. |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
You may redistribute this under the same terms as Perl itself. |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=cut |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
1; |