| 1 | package MyCPAN::Indexer::Interface::ANSIText; | ||
| 2 | use strict; | ||
| 3 | use warnings; | ||
| 4 | |||
| 5 | use parent qw(MyCPAN::Indexer::Interface::Text); | ||
| 6 | use vars qw($VERSION $logger); | ||
| 7 | $VERSION = '1.282'; | ||
| 8 | |||
| 9 | use Log::Log4perl; | ||
| 10 | use Term::ANSIColor qw(colored); | ||
| 11 | |||
| 12 | BEGIN { | ||
| 13 | my $rc = eval { | ||
| 14 | require Term::ANSIColor; | ||
| 15 | |||
| 16 | Term::ANSIColor->import( colored BLUE GREEN RED RESET ); | ||
| 17 | 1 | ||
| 18 | }; | ||
| 19 | |||
| 20 | die "You need to install the Term::ANSIColor module " . | ||
| 21 | " to use MyCPAN::Indexer::Interface::ANSIText\n" unless $rc; | ||
| 22 | } | ||
| 23 | |||
| 24 | =encoding utf8 | ||
| 25 | |||
| 26 | =head1 NAME | ||
| 27 | |||
| 28 | MyCPAN::Indexer::Interface::ANSIText - Present the run info as colored text | ||
| 29 | |||
| 30 | =head1 SYNOPSIS | ||
| 31 | |||
| 32 | Use this in C<backpan_indexer.pl> by specifying it as the interface class: | ||
| 33 | |||
| 34 | # in backpan_indexer.config | ||
| 35 | interface_class MyCPAN::Indexer::Interface::ANSIText | ||
| 36 | |||
| 37 | =head1 DESCRIPTION | ||
| 38 | |||
| 39 | This class presents the information as the indexer runs, using plain text. | ||
| 40 | Successful reports are green and failed reports are red. | ||
| 41 | |||
| 42 | =cut | ||
| 43 | |||
| 44 | sub skip_tick { BLUE, $_[0]->SUPER::skip_tick, RESET } | ||
| 45 | |||
| 46 | sub success_tick { GREEN, $_[0]->SUPER::success_tick, RESET } | ||
| 47 | |||
| 48 | sub error_tick { RED, $_[0]->SUPER::error_tick, RESET } | ||
| 49 | |||
| 50 | =head1 SEE ALSO | ||
| 51 | |||
| 52 | MyCPAN::Indexer::Interface::Text | ||
| 53 | |||
| 54 | =head1 SOURCE AVAILABILITY | ||
| 55 | |||
| 56 | This code is in Github: | ||
| 57 | |||
| 58 | git://github.com/briandfoy/mycpan-indexer.git | ||
| 59 | |||
| 60 | =head1 AUTHOR | ||
| 61 | |||
| 62 | brian d foy, C<< <bdfoy@cpan.org> >> | ||
| 63 | |||
| 64 | =head1 COPYRIGHT AND LICENSE | ||
| 65 | |||
| 66 | Copyright © 2008-2018, brian d foy <bdfoy@cpan.org>. All rights reserved. | ||
| 67 | |||
| 68 | You may redistribute this under the terms of the Artistic License 2.0. | ||
| 69 | |||
| 70 | =cut | ||
| 71 | |||
| 72 | 1; |