line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Tags::HTML::GradientIndicator; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
82998
|
use strict; |
|
2
|
|
|
|
|
10
|
|
|
2
|
|
|
|
|
54
|
|
4
|
2
|
|
|
2
|
|
86
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
62
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
1312
|
use Class::Utils qw(set_params); |
|
2
|
|
|
|
|
56395
|
|
|
2
|
|
|
|
|
37
|
|
7
|
2
|
|
|
2
|
|
138
|
use Error::Pure qw(err); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
687
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = 0.01; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# Constructor. |
12
|
|
|
|
|
|
|
sub new { |
13
|
0
|
|
|
0
|
1
|
|
my ($class, @params) = @_; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# Create object. |
16
|
0
|
|
|
|
|
|
my $self = bless {}, $class; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
# 'CSS::Struct::Output' object. |
19
|
0
|
|
|
|
|
|
$self->{'css'} = undef; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# Gradient CSS class. |
22
|
0
|
|
|
|
|
|
$self->{'css_gradient_class'} = 'gradient'; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
# Height. |
25
|
0
|
|
|
|
|
|
$self->{'height'} = 30; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
# Unit. |
28
|
0
|
|
|
|
|
|
$self->{'unit'} = 'px'; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
# Width. |
31
|
0
|
|
|
|
|
|
$self->{'width'} = 500; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
# 'Tags::Output' object. |
34
|
0
|
|
|
|
|
|
$self->{'tags'} = undef; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
# Process params. |
37
|
0
|
|
|
|
|
|
set_params($self, @params); |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
# Check to 'CSS::Struct::Output' object. |
40
|
0
|
0
|
0
|
|
|
|
if ($self->{'css'} && ! $self->{'css'}->isa('CSS::Struct::Output')) { |
41
|
0
|
|
|
|
|
|
err "Parameter 'css' must be a 'CSS::Struct::Output::*' class."; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
# Check to 'Tags' object. |
45
|
0
|
0
|
0
|
|
|
|
if (! $self->{'tags'} || ! $self->{'tags'}->isa('Tags::Output')) { |
46
|
0
|
|
|
|
|
|
err "Parameter 'tags' must be a 'Tags::Output::*' class."; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
# Object. |
50
|
0
|
|
|
|
|
|
return $self; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
# Process 'Tags'. |
54
|
|
|
|
|
|
|
sub process { |
55
|
0
|
|
|
0
|
1
|
|
my ($self, $percent_value) = @_; |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
# Value. |
58
|
0
|
|
|
|
|
|
my $value = $percent_value * ($self->{'width'} / 100); |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
# Main stars. |
61
|
|
|
|
|
|
|
$self->{'tags'}->put( |
62
|
|
|
|
|
|
|
['b', 'div'], |
63
|
|
|
|
|
|
|
['a', 'style', 'width: '.$value.$self->{'unit'}.';overflow: hidden;'], |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
['b', 'div'], |
66
|
0
|
|
|
|
|
|
['a', 'class', $self->{'css_gradient_class'}], |
67
|
|
|
|
|
|
|
['e', 'div'], |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
['e', 'div'], |
70
|
|
|
|
|
|
|
); |
71
|
|
|
|
|
|
|
|
72
|
0
|
|
|
|
|
|
return; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
# Process 'CSS::Struct'. |
76
|
|
|
|
|
|
|
sub process_css { |
77
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
$self->{'css'}->put( |
80
|
|
|
|
|
|
|
['s', '.'.$self->{'css_gradient_class'}], |
81
|
|
|
|
|
|
|
['d', 'height', $self->{'height'}.$self->{'unit'}], |
82
|
0
|
|
|
|
|
|
['d', 'width', $self->{'width'}.$self->{'unit'}], |
83
|
|
|
|
|
|
|
['d', 'background-color', 'red'], |
84
|
|
|
|
|
|
|
['d', 'background-image', 'linear-gradient(to right, red, orange, yellow, green, blue, indigo, violet)'], |
85
|
|
|
|
|
|
|
['e'], |
86
|
|
|
|
|
|
|
); |
87
|
|
|
|
|
|
|
|
88
|
0
|
|
|
|
|
|
return; |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
1; |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
__END__ |