| 1 | package App::CSE::Colorizer; | ||||||||||
| 2 | 11 | $App::CSE::Colorizer::VERSION = '0.016'; | |||||||||
| 3 | 11 | ▶ | use Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | |||||||||||
| 5 | 11 | has 'cse' => ( is => 'ro' , isa => 'App::CSE', required => 1); | |||||||||
| 6 | |||||||||||
| 7 | 11 | ▶ | 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 | 1 | ▶ | sub colored{ | ||||||||
|
Subroutine
colored: called CC=2 SCAR=7.6
Pod
documented
| |||||||||||
| 16 | 1 | my ($self, $text, $ansi_color_def) = @_; | |||||||||
| 17 | 1 | ▶ | if( $self->cse->interactive() ){ | ||||||||
|
Branch: 1 branch
| |||||||||||
| 18 | 0 | return Term::ANSIColor::colored($text, $ansi_color_def); | |||||||||
| 19 | } | ||||||||||
| 20 | 1 | return $text; | |||||||||
| 21 | } | ||||||||||
| 22 | |||||||||||
| 23 | 11 | __PACKAGE__->meta->make_immutable(); | |||||||||