line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Term::Spark; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
31595
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
41
|
|
4
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
29
|
|
5
|
1
|
|
|
1
|
|
1079
|
use utf8; |
|
1
|
|
|
|
|
9
|
|
|
1
|
|
|
|
|
6
|
|
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
|
|
12
|
use Sub::Exporter -setup => { |
8
|
|
|
|
|
|
|
'exports' => [ 'show_bar', 'show_graph' ], |
9
|
1
|
|
|
1
|
|
978
|
}; |
|
1
|
|
|
|
|
20892
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our @ISA = qw(); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our $VERSION = '0.25'; # VERSION |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub show_bar { |
16
|
0
|
|
|
0
|
0
|
|
my $num = shift; |
17
|
0
|
|
|
|
|
|
my $max = shift; |
18
|
|
|
|
|
|
|
|
19
|
0
|
|
|
|
|
|
my @graph = qw{ ▁ ▂ ▃ ▄ ▅ ▆ ▇ █ }; |
20
|
|
|
|
|
|
|
|
21
|
0
|
|
|
|
|
|
my $index = ( $num * ( scalar( @graph ) - 1 ) ) / $max; |
22
|
|
|
|
|
|
|
|
23
|
0
|
|
|
|
|
|
return $graph[ int $index ]; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub show_graph { |
27
|
0
|
|
|
0
|
0
|
|
my %args = @_; |
28
|
|
|
|
|
|
|
|
29
|
0
|
|
0
|
|
|
|
my $max = $args{'max'} || 0; |
30
|
0
|
|
0
|
|
|
|
my $values = $args{'values'} || []; |
31
|
0
|
|
|
|
|
|
my $result = q{}; |
32
|
|
|
|
|
|
|
|
33
|
0
|
|
|
|
|
|
for my $value ( @{ $values } ) { |
|
0
|
|
|
|
|
|
|
34
|
0
|
|
|
|
|
|
$result .= show_bar( $value, $max ); |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
0
|
|
|
|
|
|
return $result; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
1; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
__END__ |