File Coverage

blib/lib/App/CSE/Colorizer.pm
Criterion Covered Total %
statement 6 10 60.0
branch 0 2 0.0
condition n/a
subroutine 2 3 66.6
pod 1 1 100.0
total 9 16 56.2


line stmt bran cond sub pod time code
1             package App::CSE::Colorizer;
2             $App::CSE::Colorizer::VERSION = '0.012';
3 11     11   73 use Moose;
  11         22  
  11         113  
4              
5             has 'cse' => ( is => 'ro' , isa => 'App::CSE', required => 1);
6              
7 11     11   81361 use Term::ANSIColor qw//;
  11         95820  
  11         1730  
8              
9             =head2 colored
10              
11             Returns a colored text only in an interactive environment.
12              
13             =cut
14              
15             sub colored{
16 0     0 1   my ($self, $text, $ansi_color_def) = @_;
17 0 0         if( $self->cse->interactive() ){
18 0           return Term::ANSIColor::colored($text, $ansi_color_def);
19             }
20 0           return $text;
21             }
22              
23             __PACKAGE__->meta->make_immutable();