line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MyCPAN::Indexer::Interface::Text; |
2
|
1
|
|
|
1
|
|
1130
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
27
|
|
3
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
20
|
|
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
5
|
use Log::Log4perl; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
7
|
|
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
38
|
use parent qw(MyCPAN::Indexer::Component); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
8
|
1
|
|
|
1
|
|
57
|
use vars qw($VERSION $logger); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
70
|
|
9
|
|
|
|
|
|
|
$VERSION = '1.28_12'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 NAME |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
MyCPAN::Indexer::Interface::Text - Present the run info as plain text |
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::Text |
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
|
|
|
|
|
|
|
=item do_interface( $Notes ) |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=cut |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
BEGIN { |
36
|
1
|
|
|
1
|
|
5
|
$logger = Log::Log4perl->get_logger( 'Interface' ); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=item component_type |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
This is an interface type |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=cut |
44
|
|
|
|
|
|
|
|
45
|
0
|
|
|
0
|
1
|
|
sub component_type { $_[0]->interface_type } |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=item do_interface |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=cut |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub do_interface |
52
|
|
|
|
|
|
|
{ |
53
|
0
|
|
|
0
|
1
|
|
my( $self ) = @_; |
54
|
0
|
|
|
|
|
|
$logger->debug( "Calling do_interface" ); |
55
|
|
|
|
|
|
|
|
56
|
0
|
|
|
|
|
|
my $config = $self->get_config; |
57
|
|
|
|
|
|
|
|
58
|
0
|
|
|
|
|
|
my $i = $config->indexer_class; |
59
|
0
|
|
|
|
|
|
eval "require $i; 1"; |
60
|
|
|
|
|
|
|
|
61
|
0
|
|
|
|
|
|
print join( " ", |
62
|
|
|
|
|
|
|
$config->indexer_class, |
63
|
|
|
|
|
|
|
$config->indexer_class->VERSION |
64
|
|
|
|
|
|
|
), |
65
|
|
|
|
|
|
|
"\n"; |
66
|
|
|
|
|
|
|
|
67
|
0
|
|
|
|
|
|
my $total = @{ $self->get_note('queue') }; |
|
0
|
|
|
|
|
|
|
68
|
0
|
|
|
|
|
|
print "Processing $total distributions\n"; |
69
|
0
|
|
|
|
|
|
print "One + = 1 distribution\n"; |
70
|
|
|
|
|
|
|
|
71
|
0
|
|
|
|
|
|
my $count = 0; |
72
|
0
|
|
|
|
|
|
my $timer = time; |
73
|
|
|
|
|
|
|
|
74
|
0
|
|
|
|
|
|
while( 1 ) |
75
|
|
|
|
|
|
|
{ |
76
|
0
|
0
|
|
|
|
|
last if $self->get_note('Finished'); |
77
|
|
|
|
|
|
|
|
78
|
0
|
0
|
|
|
|
|
unless( $count++ % 70 ) |
79
|
|
|
|
|
|
|
{ |
80
|
0
|
|
|
|
|
|
my $elapsed = time - $timer; |
81
|
0
|
|
|
|
|
|
$timer = time; |
82
|
|
|
|
|
|
|
|
83
|
0
|
0
|
|
|
|
|
print " $elapsed" unless $count < 70; |
84
|
0
|
|
|
|
|
|
printf "\n[%6d/%6d]", $count, $total; |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
0
|
|
|
|
|
|
local $| = 1; |
88
|
|
|
|
|
|
|
|
89
|
0
|
|
|
|
|
|
my $info = $self->get_note('interface_callback')->(); |
90
|
|
|
|
|
|
|
|
91
|
0
|
|
|
|
|
|
my $method = do { |
92
|
0
|
0
|
0
|
|
|
|
if( not defined $info or ref $info ne ref {} ) { 'error_tick' } |
|
0
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
93
|
0
|
|
|
|
|
|
elsif( $info->{'completed'} ) { 'success_tick' } |
94
|
0
|
|
|
|
|
|
elsif( $info->{'skipped'} ) { 'skip_tick' } |
|
0
|
|
|
|
|
|
|
95
|
0
|
|
|
|
|
|
elsif( grep { exists $info->{$_} } qw( error fatal_error ) ) { 'error_tick' } |
96
|
0
|
|
|
|
|
|
else { 'error_tick' } |
97
|
|
|
|
|
|
|
}; |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
# if we fork, how does the interface class know what happened? |
100
|
0
|
|
|
|
|
|
$method = 'success_tick'; |
101
|
|
|
|
|
|
|
|
102
|
0
|
|
|
|
|
|
print $self->$method(); |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
} |
105
|
0
|
|
|
|
|
|
print "\n"; |
106
|
|
|
|
|
|
|
|
107
|
0
|
|
|
|
|
|
my $collator = $self->get_coordinator->get_note( 'collator' ); |
108
|
0
|
0
|
|
0
|
|
|
$collator->() if ref $collator eq ref sub {}; |
|
0
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
} |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=item skip_tick |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=item success_tick |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=item error_tick |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
Return a grapheme to represent what just happened. |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=cut |
120
|
|
|
|
|
|
|
|
121
|
0
|
|
|
0
|
1
|
|
sub skip_tick { '.' } |
122
|
|
|
|
|
|
|
|
123
|
0
|
|
|
0
|
1
|
|
sub success_tick { '+' } |
124
|
|
|
|
|
|
|
|
125
|
0
|
|
|
0
|
1
|
|
sub error_tick { '!' } |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=back |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=head1 SEE ALSO |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
MyCPAN::Indexer |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=head1 SOURCE AVAILABILITY |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
This code is in Github: |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
git://github.com/briandfoy/mycpan-indexer.git |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=head1 AUTHOR |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
brian d foy, C<< >> |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
Copyright (c) 2008-2013, brian d foy, All Rights Reserved. |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
You may redistribute this under the same terms as Perl itself. |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=cut |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
1; |