line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#!/usr/bin/perl |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package Test::TAP::Model::Colorful; |
4
|
|
|
|
|
|
|
|
5
|
9
|
|
|
9
|
|
33173
|
use strict; |
|
9
|
|
|
|
|
16
|
|
|
9
|
|
|
|
|
390
|
|
6
|
9
|
|
|
9
|
|
47
|
use warnings; |
|
9
|
|
|
|
|
16
|
|
|
9
|
|
|
|
|
204
|
|
7
|
|
|
|
|
|
|
|
8
|
9
|
|
|
9
|
|
2986
|
use Test::TAP::Model; |
|
9
|
|
|
|
|
79078
|
|
|
9
|
|
|
|
|
256
|
|
9
|
9
|
|
|
9
|
|
62
|
use Test::TAP::Model::File; |
|
9
|
|
|
|
|
21
|
|
|
9
|
|
|
|
|
425
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# yucky mixin behavior |
12
|
|
|
|
|
|
|
BEGIN { |
13
|
9
|
|
|
9
|
|
162
|
push @Test::TAP::Model::ISA, __PACKAGE__; |
14
|
9
|
|
|
|
|
1342
|
push @Test::TAP::Model::File::ISA, __PACKAGE__; |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub color { |
18
|
21
|
|
|
21
|
1
|
888
|
my $self = shift; |
19
|
|
|
|
|
|
|
|
20
|
21
|
|
|
|
|
109
|
my $ratio = $self->ratio; |
21
|
|
|
|
|
|
|
|
22
|
21
|
|
|
|
|
974
|
my $l= 100; |
23
|
21
|
100
|
|
|
|
71
|
if ($ratio == 1){ |
24
|
4
|
|
|
|
|
56
|
return "#00ff00"; |
25
|
|
|
|
|
|
|
} else { |
26
|
17
|
|
|
|
|
158
|
return sprintf("#ff%02x%02x", $l + ((255 - $l) * $ratio), $l-20); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub color_css { |
31
|
19
|
|
|
19
|
1
|
3638
|
my $self = shift; |
32
|
19
|
|
|
|
|
109
|
return "background-color: " . $self->color; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
__PACKAGE__ |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
__END__ |