| MyCPAN-Indexer documentation | Contained in the MyCPAN-Indexer distribution. |
MyCPAN::Indexer::Interface::Text - Present the run info as plain text
Use this in backpan_indexer.pl by specifying it as the interface class:
# in backpan_indexer.config interface_class MyCPAN::Indexer::Interface::Text
This class presents the information as the indexer runs, using plain text.
MyCPAN::Indexer
This code is in Github:
git://github.com/briandfoy/mycpan-indexer.git
brian d foy, <bdfoy@cpan.org>
Copyright (c) 2008-2009, brian d foy, All Rights Reserved.
You may redistribute this under the same terms as Perl itself.
| MyCPAN-Indexer documentation | Contained in the MyCPAN-Indexer distribution. |
package MyCPAN::Indexer::Interface::Text; use strict; use warnings; use Log::Log4perl; use base qw(MyCPAN::Indexer::Component); use vars qw($VERSION $logger); $VERSION = '1.28';
BEGIN { $logger = Log::Log4perl->get_logger( 'Interface' ); } sub component_type { $_[0]->interface_type } sub do_interface { my( $self ) = @_; $logger->debug( "Calling do_interface" ); my $config = $self->get_config; my $i = $config->indexer_class; eval "require $i; 1"; print join( " ", $config->indexer_class, $config->indexer_class->VERSION ), "\n"; print 'Processing ' . @{ $self->get_note('queue') } . " distributions\n"; print "One * = 1 distribution\n"; my $count = 0; while( 1 ) { last if $self->get_note('Finished'); local $| = 1; my $info = $self->get_note('interface_callback')->(); my $method = do { if( not defined $info or ref $info ne ref {} ) { 'error_tick' } elsif( $info->{'completed'} ) { 'success_tick' } elsif( $info->{'skipped'} ) { 'skip_tick' } elsif( grep { exists $info->{$_} } qw( error fatal_error ) ) { 'error_tick' } else { 'error_tick' } }; # if we fork, how does the interface class know what happened? $method = 'success_tick'; print $self->$method(); print "\n" unless ++$count % 70; } print "\n"; } sub skip_tick { '.' } sub success_tick { '+' } sub error_tick { '!' }
1;