line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Plack::App::Tags::HTML; |
2
|
|
|
|
|
|
|
|
3
|
6
|
|
|
6
|
|
266066
|
use base qw(Plack::Component::Tags::HTML); |
|
6
|
|
|
|
|
40
|
|
|
6
|
|
|
|
|
3176
|
|
4
|
6
|
|
|
6
|
|
428838
|
use strict; |
|
6
|
|
|
|
|
19
|
|
|
6
|
|
|
|
|
131
|
|
5
|
6
|
|
|
6
|
|
31
|
use warnings; |
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
163
|
|
6
|
|
|
|
|
|
|
|
7
|
6
|
|
|
6
|
|
36
|
use English; |
|
6
|
|
|
|
|
18
|
|
|
6
|
|
|
|
|
53
|
|
8
|
6
|
|
|
6
|
|
3125
|
use Error::Pure qw(err); |
|
6
|
|
|
|
|
15
|
|
|
6
|
|
|
|
|
265
|
|
9
|
6
|
|
|
6
|
|
35
|
use Plack::Util::Accessor qw(component constructor_args data data_css data_init); |
|
6
|
|
|
|
|
11
|
|
|
6
|
|
|
|
|
72
|
|
10
|
6
|
|
|
6
|
|
3521
|
use Symbol::Get; |
|
6
|
|
|
|
|
10629
|
|
|
6
|
|
|
|
|
3017
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $VERSION = 0.13; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub _css { |
15
|
5
|
|
|
5
|
|
1321
|
my ($self, $env) = @_; |
16
|
|
|
|
|
|
|
|
17
|
5
|
50
|
|
|
|
45
|
if ($self->{'_component'}->can('process_css')) { |
18
|
5
|
|
|
|
|
13
|
my @data_css; |
19
|
5
|
50
|
|
|
|
22
|
if (defined $self->data_css) { |
20
|
0
|
|
|
|
|
0
|
push @data_css, @{$self->data_css}; |
|
0
|
|
|
|
|
0
|
|
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
5
|
|
|
|
|
68
|
$self->{'_component'}->process_css(@data_css); |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
5
|
|
|
|
|
39
|
return; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub _loaded_component { |
30
|
5
|
|
|
5
|
|
18
|
my ($self, $component) = @_; |
31
|
|
|
|
|
|
|
|
32
|
5
|
|
|
|
|
16
|
my @names = eval { |
33
|
5
|
|
|
|
|
45
|
Symbol::Get::get_names($component); |
34
|
|
|
|
|
|
|
}; |
35
|
5
|
100
|
|
|
|
292
|
if ($EVAL_ERROR) { |
36
|
4
|
|
|
|
|
17
|
return 0; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
1
|
|
|
|
|
8
|
return 1; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub _prepare_app { |
43
|
5
|
|
|
5
|
|
99338
|
my $self = shift; |
44
|
|
|
|
|
|
|
|
45
|
5
|
|
|
|
|
43
|
$self->SUPER::_prepare_app(); |
46
|
|
|
|
|
|
|
|
47
|
5
|
|
|
|
|
4580
|
my %p = ( |
48
|
|
|
|
|
|
|
'css' => $self->css, |
49
|
|
|
|
|
|
|
'tags' => $self->tags, |
50
|
|
|
|
|
|
|
); |
51
|
|
|
|
|
|
|
|
52
|
5
|
|
|
|
|
65
|
my $component = $self->component; |
53
|
5
|
100
|
|
|
|
48
|
if (! $self->_loaded_component($component)) { |
54
|
4
|
|
|
|
|
294
|
eval "require $component;"; |
55
|
4
|
50
|
|
|
|
1476
|
if ($EVAL_ERROR) { |
56
|
0
|
|
|
|
|
0
|
err "Cannot load component '$component'.", |
57
|
|
|
|
|
|
|
'Error', $EVAL_ERROR; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
$self->{'_component'} = $component->new( |
61
|
|
|
|
|
|
|
%p, |
62
|
|
|
|
|
|
|
defined $self->constructor_args ? ( |
63
|
5
|
50
|
|
|
|
41
|
%{$self->constructor_args}, |
|
0
|
|
|
|
|
0
|
|
64
|
|
|
|
|
|
|
) : (), |
65
|
|
|
|
|
|
|
); |
66
|
5
|
50
|
|
|
|
390
|
if (! $self->{'_component'}->isa('Tags::HTML')) { |
67
|
0
|
|
|
|
|
0
|
err "Component must be a instance of 'Tags::HTML' class."; |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
5
|
|
|
|
|
23
|
return; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub _process_actions { |
74
|
5
|
|
|
5
|
|
119
|
my ($self, $env) = @_; |
75
|
|
|
|
|
|
|
|
76
|
5
|
50
|
|
|
|
75
|
if ($self->{'_component'}->can('init')) { |
77
|
5
|
|
|
|
|
17
|
my @data = (); |
78
|
5
|
100
|
|
|
|
35
|
if (defined $self->data_init) { |
79
|
1
|
|
|
|
|
7
|
push @data, @{$self->data_init}; |
|
1
|
|
|
|
|
3
|
|
80
|
|
|
|
|
|
|
} |
81
|
5
|
|
|
|
|
48
|
$self->{'_component'}->init(@data); |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
5
|
|
|
|
|
81
|
return; |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
sub _tags_middle { |
88
|
5
|
|
|
5
|
|
10124
|
my ($self, $env) = @_; |
89
|
|
|
|
|
|
|
|
90
|
5
|
|
|
|
|
12
|
my @data; |
91
|
5
|
100
|
|
|
|
23
|
if (defined $self->data) { |
92
|
1
|
|
|
|
|
8
|
push @data, @{$self->data}; |
|
1
|
|
|
|
|
4
|
|
93
|
|
|
|
|
|
|
} |
94
|
5
|
|
|
|
|
67
|
$self->{'_component'}->process(@data); |
95
|
|
|
|
|
|
|
|
96
|
5
|
|
|
|
|
1502
|
return; |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
1; |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
__END__ |