line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
451
|
use 5.006; |
|
1
|
|
|
|
|
2
|
|
2
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
22
|
|
3
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
84
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package App::colourhexdump::DefaultColourProfile; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '1.000003'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# ABSTRACT: The default colour profile |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:KENTNL'; # AUTHORITY |
12
|
|
|
|
|
|
|
|
13
|
1
|
|
|
1
|
|
468
|
use Moose qw( has with ); |
|
1
|
|
|
|
|
426631
|
|
|
1
|
|
|
|
|
8
|
|
14
|
1
|
|
|
1
|
|
5995
|
use namespace::autoclean; |
|
1
|
|
|
|
|
7697
|
|
|
1
|
|
|
|
|
4
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
with 'App::colourhexdump::ColourProfile'; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
19
|
1
|
|
|
1
|
|
76
|
no Moose; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
7
|
|
20
|
|
|
|
|
|
|
|
21
|
1
|
|
|
1
|
|
767
|
use Term::ANSIColor 3.00 qw( BLACK ON_RED BOLD BRIGHT_BLUE BRIGHT_YELLOW ON_YELLOW RED BLUE YELLOW ); |
|
1
|
|
|
|
|
5912
|
|
|
1
|
|
|
|
|
1647
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
## no critic ( Subroutines::RequireArgUnpacking ) |
30
|
|
|
|
|
|
|
sub get_colour_for { |
31
|
0
|
0
|
|
0
|
1
|
|
return BLACK . ON_RED if $_[1] =~ /\r/; |
32
|
0
|
0
|
|
|
|
|
return BOLD . BRIGHT_BLUE if $_[1] =~ /\n/; |
33
|
0
|
0
|
|
|
|
|
return BLUE if $_[1] =~ / /; |
34
|
0
|
0
|
|
|
|
|
return BOLD . BRIGHT_BLUE . ON_YELLOW if $_[1] =~ /\t/; |
35
|
0
|
0
|
|
|
|
|
return RED if $_[1] =~ qr{[^[:print:]]}; |
36
|
0
|
0
|
|
|
|
|
return if $_[1] =~ qr{[[:alpha:]\d]}; |
37
|
0
|
|
|
|
|
|
return YELLOW; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
## no critic ( Subroutines::RequireArgUnpacking ) |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub get_display_symbol_for { |
49
|
0
|
0
|
|
0
|
1
|
|
return q{_} if $_[1] =~ qr{\s}; |
50
|
0
|
0
|
|
|
|
|
return q{.} if $_[1] =~ qr{[^[:print:]]}; |
51
|
0
|
|
|
|
|
|
return $_[1]; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
1; |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
__END__ |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=pod |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=encoding UTF-8 |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 NAME |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
App::colourhexdump::DefaultColourProfile - The default colour profile |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 VERSION |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
version 1.000003 |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head1 SYNOPSIS |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
This is the default colour profile. |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
\r => black on red '_' |
75
|
|
|
|
|
|
|
\n => bold bright blue '_' |
76
|
|
|
|
|
|
|
" " => blue '_' |
77
|
|
|
|
|
|
|
\t => bold bright blue on yellow '_' |
78
|
|
|
|
|
|
|
alphanumeric => white $char |
79
|
|
|
|
|
|
|
nonprintable => red '.' |
80
|
|
|
|
|
|
|
everything else => yellow $char |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
Invocation: |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
my $cp = App::colourhexdump::DefaultColourProfile->new(); |
85
|
|
|
|
|
|
|
my $colouredChar = |
86
|
|
|
|
|
|
|
$cp->get_string_pre( $char ) . |
87
|
|
|
|
|
|
|
$cp->get_dispaly_symbol_for( $char ) . |
88
|
|
|
|
|
|
|
$cp->get_string_post( $char ); |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head1 METHODS |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head2 get_colour_for |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
See L<App::colourhexdump::ColourProfile/get_colour_for> |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head2 get_display_symbol_for |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
See L<App::colourhexdump::ColourProfile/get_display_symbol_for> |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head1 AUTHOR |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
Kent Fredric <kentnl@cpan.org> |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
This software is copyright (c) 2017 by Kent Fredric <kentnl@cpan.org>. |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
109
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=cut |