Model/Colorful.pm

filter: Statementstmt 77.7% 7 / 9 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 3 / 3 Podpod n/a totaltotal 83.3% 10 / 12 CC 1 SCAR 0.9
CC
1
Cov
78%
BEGIN
1.3
BEGIN
1.0
BEGIN
1.0
CRAP 1.1
« HTMLMatrix.pm ↑ Summary Model/File/Visual.pm »
1 #!/usr/bin/perl
2  
3 package Test::TAP::Model::Colorful;
4  
5 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 0 ▶use Test::TAP::Model;
Subroutine BEGIN: called CC=1 SCAR=2.6
9 use Test::TAP::Model::File;
10  
11 # yucky mixin behavior
12 BEGIN {
13 push @Test::TAP::Model::ISA, __PACKAGE__;
14 push @Test::TAP::Model::File::ISA, __PACKAGE__;
15 }
16  
17 sub color {
18 my $self = shift;
19  
20 my $ratio = $self->ratio;
21  
22 my $l= 100;
23 if ($ratio == 1){
24 return "#00ff00";
25 } else {
26 return sprintf("#ff%02x%02x", $l + ((255 - $l) * $ratio), $l-20);
27 }
28 }
29  
30 sub color_css {
31 my $self = shift;
32 return "background-color: " . $self->color;
33 }
34  
35 __PACKAGE__
36  
37 __END__
« HTMLMatrix.pm ↑ Summary Model/File/Visual.pm »