blib/lib/Acme/KemonoFriends/Color.pm

filter: Statementstmt 90.0% 27 / 30 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 88.8% 8 / 9 Podpod 0.0% 0 / 1 totaltotal 87.5% 35 / 40 CC 2 SCAR 6.9
CC
2
Cov
90%
printk
6.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.0
↑ Summary
1 package Acme::KemonoFriends::Color;
2 2 ▶use 5.008001;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 2 ▶use Encode qw( encode );
Subroutine BEGIN: called CC=1 SCAR=0.0
7 2 ▶use Exporter 'import';
Subroutine BEGIN: called CC=1 SCAR=0.0
8 2 our @EXPORT = qw( printk );
9 2 our $VERSION = "0.01";
10  
11 2 my @KemonoFriends_color = qw(
12 35 112 208 202
13 36 198 39 32
14 248 253 196 190
15 126 207
16 );
17  
18 0 ▶sub printk {
Subroutine printk: not called CC=2 SCAR=17.9
Pod undocumented
19 0 my $message = shift;
20 0 my @strings = split('',$message);
21 0 print encode('utf-8', _escaped_message($_)) for @strings;
22 }
23  
24 2 ▶sub _get_color_code {
Subroutine _get_color_code: called CC=1 SCAR=0.0
25 2 my $code = $KemonoFriends_color[int( rand($#KemonoFriends_color) )];
26  
27 2 return '1;38;5;'.$code;
28 }
29  
30 1 ▶sub _escaped_message {
Subroutine _escaped_message: called CC=1 SCAR=0.0
31 1 my $message = shift;
32  
33 1 my $begin = "\e[" . _get_color_code() . "m";
34 1 my $end = "\e[m";
35 1 return $begin . $message . $end;
36 }
37  
38 2 1;
39 __END__
↑ Summary