App::colourhexdump::ColourProfile - A Role for Colour Profiles
version 1.000003
package App::colourhexdump::ColourProfileName use Moose; with qw( App::colourhexdump::ColourProfile ); sub get_colour_for { my ( $self, $char ) = @_ ; ... return "\e[31m" if /badthings/; return undef; # don't colour } sub get_display_symbol_for { my ($self, $char) = @_ ; ... return '.' if $char =~ /badthings/ return $char; # printable }
get_colour_for
my $colour = $object->get_colour_for( "\n" );
Return any string of data that should be prepended every time a given character is seen.
Generally, you only want to print ANSI Escape codes.
Don't worry about resetting things, we put a ^[[0m in for you.
^[[0m
Return undef if you do not wish to apply colouring.
undef
get_display_symbol_for
my $symbol = $object->get_display_symbol_for( "\n" );
Returns a user viewable alternative to the matched string.
get_string_pre
Wraps "get_colour_for" and returns either a string sequence or ''.
get_string_post
Wraps "get_colour_for" and returns either an ANSI Reset Code, or '', depending on what was returned.
Kent Fredric <kentnl@cpan.org>
This software is copyright (c) 2017 by Kent Fredric <kentnl@cpan.org>.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install App::colourhexdump, copy and paste the appropriate command in to your terminal.
cpanm
cpanm App::colourhexdump
CPAN shell
perl -MCPAN -e shell install App::colourhexdump
For more information on module installation, please visit the detailed CPAN module installation guide.