line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Plack::App::Tags::HTML; |
2
|
|
|
|
|
|
|
|
3
|
7
|
|
|
7
|
|
315270
|
use base qw(Plack::Component::Tags::HTML); |
|
7
|
|
|
|
|
45
|
|
|
7
|
|
|
|
|
3794
|
|
4
|
7
|
|
|
7
|
|
498715
|
use strict; |
|
7
|
|
|
|
|
21
|
|
|
7
|
|
|
|
|
156
|
|
5
|
7
|
|
|
7
|
|
37
|
use warnings; |
|
7
|
|
|
|
|
15
|
|
|
7
|
|
|
|
|
189
|
|
6
|
|
|
|
|
|
|
|
7
|
7
|
|
|
7
|
|
46
|
use English; |
|
7
|
|
|
|
|
18
|
|
|
7
|
|
|
|
|
67
|
|
8
|
7
|
|
|
7
|
|
3607
|
use Error::Pure qw(err); |
|
7
|
|
|
|
|
16
|
|
|
7
|
|
|
|
|
362
|
|
9
|
7
|
|
|
7
|
|
74
|
use Plack::Util::Accessor qw(component constructor_args data data_css data_init data_prepare); |
|
7
|
|
|
|
|
37
|
|
|
7
|
|
|
|
|
63
|
|
10
|
7
|
|
|
7
|
|
4134
|
use Symbol::Get; |
|
7
|
|
|
|
|
12341
|
|
|
7
|
|
|
|
|
3911
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $VERSION = 0.14; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub _css { |
15
|
6
|
|
|
6
|
|
1853
|
my ($self, $env) = @_; |
16
|
|
|
|
|
|
|
|
17
|
6
|
50
|
|
|
|
42
|
if ($self->{'_component'}->can('process_css')) { |
18
|
6
|
|
|
|
|
30
|
my @data_css; |
19
|
6
|
50
|
|
|
|
34
|
if (defined $self->data_css) { |
20
|
0
|
|
|
|
|
0
|
push @data_css, @{$self->data_css}; |
|
0
|
|
|
|
|
0
|
|
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
6
|
|
|
|
|
111
|
$self->{'_component'}->process_css(@data_css); |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
6
|
|
|
|
|
54
|
return; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub _loaded_component { |
30
|
6
|
|
|
6
|
|
28
|
my ($self, $component) = @_; |
31
|
|
|
|
|
|
|
|
32
|
6
|
|
|
|
|
21
|
my @names = eval { |
33
|
6
|
|
|
|
|
48
|
Symbol::Get::get_names($component); |
34
|
|
|
|
|
|
|
}; |
35
|
6
|
100
|
|
|
|
373
|
if ($EVAL_ERROR) { |
36
|
5
|
|
|
|
|
35
|
return 0; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
1
|
|
|
|
|
4
|
return 1; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub _prepare_app { |
43
|
6
|
|
|
6
|
|
127158
|
my $self = shift; |
44
|
|
|
|
|
|
|
|
45
|
6
|
|
|
|
|
58
|
$self->SUPER::_prepare_app(); |
46
|
|
|
|
|
|
|
|
47
|
6
|
|
|
|
|
5587
|
my %p = ( |
48
|
|
|
|
|
|
|
'css' => $self->css, |
49
|
|
|
|
|
|
|
'tags' => $self->tags, |
50
|
|
|
|
|
|
|
); |
51
|
|
|
|
|
|
|
|
52
|
6
|
|
|
|
|
86
|
my $component = $self->component; |
53
|
6
|
100
|
|
|
|
52
|
if (! $self->_loaded_component($component)) { |
54
|
5
|
|
|
|
|
365
|
eval "require $component;"; |
55
|
5
|
50
|
|
|
|
2018
|
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
|
6
|
50
|
|
|
|
55
|
%{$self->constructor_args}, |
|
0
|
|
|
|
|
0
|
|
64
|
|
|
|
|
|
|
) : (), |
65
|
|
|
|
|
|
|
); |
66
|
6
|
50
|
|
|
|
470
|
if (! $self->{'_component'}->isa('Tags::HTML')) { |
67
|
0
|
|
|
|
|
0
|
err "Component must be a instance of 'Tags::HTML' class."; |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
# Init prepared data. |
71
|
6
|
50
|
|
|
|
62
|
if ($self->{'_component'}->can('prepare')) { |
72
|
6
|
|
|
|
|
23
|
my @data = (); |
73
|
6
|
100
|
|
|
|
46
|
if (defined $self->data_prepare) { |
74
|
1
|
|
|
|
|
7
|
push @data, @{$self->data_prepare}; |
|
1
|
|
|
|
|
3
|
|
75
|
|
|
|
|
|
|
} |
76
|
6
|
|
|
|
|
66
|
$self->{'_component'}->prepare(@data); |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
6
|
|
|
|
|
102
|
return; |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
sub _process_actions { |
83
|
6
|
|
|
6
|
|
202
|
my ($self, $env) = @_; |
84
|
|
|
|
|
|
|
|
85
|
6
|
50
|
|
|
|
53
|
if ($self->{'_component'}->can('init')) { |
86
|
6
|
|
|
|
|
16
|
my @data = (); |
87
|
6
|
100
|
|
|
|
41
|
if (defined $self->data_init) { |
88
|
1
|
|
|
|
|
18
|
push @data, @{$self->data_init}; |
|
1
|
|
|
|
|
3
|
|
89
|
|
|
|
|
|
|
} |
90
|
6
|
|
|
|
|
59
|
$self->{'_component'}->init(@data); |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
6
|
|
|
|
|
128
|
return; |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
sub _tags_middle { |
97
|
6
|
|
|
6
|
|
12410
|
my ($self, $env) = @_; |
98
|
|
|
|
|
|
|
|
99
|
6
|
|
|
|
|
16
|
my @data; |
100
|
6
|
100
|
|
|
|
29
|
if (defined $self->data) { |
101
|
1
|
|
|
|
|
7
|
push @data, @{$self->data}; |
|
1
|
|
|
|
|
4
|
|
102
|
|
|
|
|
|
|
} |
103
|
6
|
|
|
|
|
78
|
$self->{'_component'}->process(@data); |
104
|
|
|
|
|
|
|
|
105
|
6
|
|
|
|
|
1935
|
return; |
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
1; |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
__END__ |