1 package TAP::Formatter::Console;
4 use TAP::Formatter::Base ();
5 use POSIX qw(strftime);
7 use vars qw($VERSION @ISA);
9 @ISA = qw(TAP::Formatter::Base);
13 TAP::Formatter::Console - Harness output delegate for default console output
25 This provides console orientated output formatting for TAP::Harness.
29 use TAP::Formatter::Console;
30 my $harness = TAP::Formatter::Console->new( \%args );
32 =head2 C<< open_test >>
34 See L<TAP::Formatter::base>
39 my ( $self, $test, $parser ) = @_;
43 ? 'TAP::Formatter::Console::ParallelSession'
44 : 'TAP::Formatter::Console::Session';
46 eval "require $class";
47 $self->_croak($@) if $@;
49 my $session = $class->new(
53 show_count => $self->show_count,
62 # Use _colorizer delegate to set output color. NOP if we have no delegate
64 my ( $self, @colors ) = @_;
65 if ( my $colorizer = $self->_colorizer ) {
66 my $output_func = $self->{_output_func} ||= sub {
69 $colorizer->set_color( $output_func, $_ ) for @colors;
74 my ( $self, $msg ) = @_;
75 $self->_set_colors('green');
77 $self->_set_colors('reset');
82 $self->_set_colors('red');
83 my $out = join '', @_;
84 my $has_newline = chomp $out;
86 $self->_set_colors('reset');