line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::Tel::Color::Base; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 name |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
App::Tel::Color::Base - parent stub and examples for Color modules |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=cut |
8
|
|
|
|
|
|
|
|
9
|
2
|
|
|
2
|
|
3610
|
use Term::ANSIColor; |
|
2
|
|
|
|
|
15156
|
|
|
2
|
|
|
|
|
135
|
|
10
|
2
|
|
|
2
|
|
17
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
79
|
|
11
|
2
|
|
|
2
|
|
9
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
417
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our $VERSION = '0.2'; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
$Term::ANSIColor::AUTORESET++; # reset color after each print |
16
|
|
|
|
|
|
|
$SIG{INT} = sub { print "\n"; exit; }; # reset color after Ctrl-C |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
our @colors = qw ( GREEN YELLOW BLUE MAGENTA CYAN WHITE ); |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
# Bright colors were added after Term::ANSIColor 3.00 |
21
|
|
|
|
|
|
|
if ($Term::ANSIColor::VERSION >= 3.00) { |
22
|
|
|
|
|
|
|
push(@colors, qw ( |
23
|
|
|
|
|
|
|
BRIGHT_GREEN BRIGHT_YELLOW |
24
|
|
|
|
|
|
|
BRIGHT_BLUE BRIGHT_MAGENTA BRIGHT_CYAN BRIGHT_WHITE |
25
|
|
|
|
|
|
|
)); |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head1 METHODS |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head2 new |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
my $colorobject = new App::Tel::Base; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
Initializes a new colorobject. |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=cut |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub new { |
41
|
5
|
|
|
5
|
1
|
2105
|
my $proto = shift; |
42
|
5
|
|
33
|
|
|
25
|
my $class = ref($proto) || $proto; |
43
|
|
|
|
|
|
|
|
44
|
5
|
|
|
|
|
24
|
return bless( { }, $class); |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head2 colorize |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
$colorobject->colorize('text'); |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
Normally this will consume text from an input buffer and have some logic that |
52
|
|
|
|
|
|
|
determines how it will color the output. This method is designed to be |
53
|
|
|
|
|
|
|
overridden in all child modules. |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=cut |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub colorize { |
59
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
60
|
0
|
|
|
|
|
|
$_ = shift; |
61
|
|
|
|
|
|
|
|
62
|
0
|
|
|
|
|
|
return colored($_, 'cyan'); |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
1; |