JESP/Colorizer.pm

filter: Statementstmt 100% 13 / 13 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 3 / 3 Podpod 100% 1 / 1 totaltotal 100% 19 / 19 CC 2 SCAR 4.1
CC
2
Cov
100%
colored
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.5
« JESP/Cmd/Command/deploy.pm ↑ Summary JESP/Cmd/Command/status.pm »
1 package App::JESP::Colorizer;
2 8 $App::JESP::Colorizer::VERSION = '0.016';
3 8 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 8 has 'jesp' => ( is => 'ro' , isa => 'App::JESP', required => 1);
6  
7 8 ▶use Term::ANSIColor qw//;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 =head2 colored
10  
11 Returns a colored text only in an interactive environment.
12  
13 =cut
14  
15 26 ▶sub colored{
Subroutine colored: called CC=2 SCAR=6.9
Pod documented
16 26 my ($self, $text, $ansi_color_def) = @_;
17 26 ▶ if( $self->jesp->interactive() ){
Branch: 1 branch
BranchTrueFalseTotal
if ($self->jesp->interactive) 1 25 26
18 1 return Term::ANSIColor::colored($text, $ansi_color_def);
19 }
20 25 return $text;
21 }
22  
23 8 __PACKAGE__->meta->make_immutable();
« JESP/Cmd/Command/deploy.pm ↑ Summary JESP/Cmd/Command/status.pm »