line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Plack::App::Login; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
151128
|
use base qw(Plack::Component); |
|
4
|
|
|
|
|
27
|
|
|
4
|
|
|
|
|
1931
|
|
4
|
4
|
|
|
4
|
|
49474
|
use strict; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
90
|
|
5
|
4
|
|
|
4
|
|
19
|
use warnings; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
95
|
|
6
|
|
|
|
|
|
|
|
7
|
4
|
|
|
4
|
|
1948
|
use CSS::Struct::Output::Raw; |
|
4
|
|
|
|
|
86936
|
|
|
4
|
|
|
|
|
144
|
|
8
|
4
|
|
|
4
|
|
33
|
use Error::Pure qw(err); |
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
309
|
|
9
|
4
|
|
|
4
|
|
1844
|
use Plack::Util::Accessor qw(css generator login_link login_title tags title); |
|
4
|
|
|
|
|
1078
|
|
|
4
|
|
|
|
|
29
|
|
10
|
4
|
|
|
4
|
|
386
|
use Scalar::Util qw(blessed); |
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
179
|
|
11
|
4
|
|
|
4
|
|
1939
|
use Tags::HTML::Login::Button; |
|
4
|
|
|
|
|
6850
|
|
|
4
|
|
|
|
|
121
|
|
12
|
4
|
|
|
4
|
|
1975
|
use Tags::HTML::Page::Begin; |
|
4
|
|
|
|
|
9958
|
|
|
4
|
|
|
|
|
120
|
|
13
|
4
|
|
|
4
|
|
1895
|
use Tags::HTML::Page::End; |
|
4
|
|
|
|
|
1104
|
|
|
4
|
|
|
|
|
106
|
|
14
|
4
|
|
|
4
|
|
1995
|
use Tags::Output::Raw; |
|
4
|
|
|
|
|
117420
|
|
|
4
|
|
|
|
|
206
|
|
15
|
4
|
|
|
4
|
|
1878
|
use Unicode::UTF8 qw(decode_utf8 encode_utf8); |
|
4
|
|
|
|
|
1834
|
|
|
4
|
|
|
|
|
2201
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
our $VERSION = 0.07; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub call { |
20
|
3
|
|
|
3
|
1
|
27
|
my ($self, $env) = @_; |
21
|
|
|
|
|
|
|
|
22
|
3
|
|
|
|
|
9
|
$self->_tags; |
23
|
3
|
|
|
|
|
8
|
$self->tags->finalize; |
24
|
3
|
|
|
|
|
52
|
my $content = encode_utf8($self->tags->flush(1)); |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
return [ |
27
|
3
|
|
|
|
|
550
|
200, |
28
|
|
|
|
|
|
|
[ |
29
|
|
|
|
|
|
|
'content-type' => 'text/html; charset=utf-8', |
30
|
|
|
|
|
|
|
], |
31
|
|
|
|
|
|
|
[$content], |
32
|
|
|
|
|
|
|
]; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub prepare_app { |
36
|
5
|
|
|
5
|
1
|
32165
|
my $self = shift; |
37
|
|
|
|
|
|
|
|
38
|
5
|
100
|
|
|
|
20
|
if ($self->css) { |
39
|
3
|
100
|
66
|
|
|
61
|
if (! blessed($self->css) || ! $self->css->isa('CSS::Struct::Output')) { |
40
|
1
|
|
|
|
|
16
|
err "Bad 'CSS::Struct::Output' object."; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
} else { |
43
|
2
|
|
|
|
|
39
|
$self->css(CSS::Struct::Output::Raw->new); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
4
|
100
|
|
|
|
320
|
if ($self->tags) { |
47
|
3
|
100
|
66
|
|
|
21
|
if (! blessed($self->tags) || ! $self->tags->isa('Tags::Output')) { |
48
|
1
|
|
|
|
|
9
|
err "Bad 'Tags::Output' object."; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
} else { |
51
|
1
|
|
|
|
|
37
|
$self->tags(Tags::Output::Raw->new('xml' => 1)); |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
3
|
100
|
|
|
|
323
|
if (! $self->generator) { |
55
|
2
|
|
|
|
|
27
|
$self->generator(__PACKAGE__.'; Version: '.$VERSION); |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
3
|
100
|
|
|
|
19
|
if (! $self->title) { |
59
|
2
|
|
|
|
|
13
|
$self->title('Login page'); |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
3
|
100
|
|
|
|
18
|
if (! $self->login_link) { |
63
|
2
|
|
|
|
|
23
|
$self->login_link('login'); |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
3
|
100
|
|
|
|
16
|
if (! $self->login_title) { |
67
|
2
|
|
|
|
|
10
|
$self->login_title('LOGIN'); |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
# Tags helper for begin of page. |
71
|
3
|
|
|
|
|
15
|
$self->{'_page_begin'} = Tags::HTML::Page::Begin->new( |
72
|
|
|
|
|
|
|
'css' => $self->css, |
73
|
|
|
|
|
|
|
'generator' => $self->generator, |
74
|
|
|
|
|
|
|
'lang' => { |
75
|
|
|
|
|
|
|
'title' => $self->title, |
76
|
|
|
|
|
|
|
}, |
77
|
|
|
|
|
|
|
'tags' => $self->tags, |
78
|
|
|
|
|
|
|
); |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
# Tags helper for login button. |
81
|
3
|
|
|
|
|
801
|
$self->{'_login_button'} = Tags::HTML::Login::Button->new( |
82
|
|
|
|
|
|
|
'css' => $self->css, |
83
|
|
|
|
|
|
|
'link' => $self->login_link, |
84
|
|
|
|
|
|
|
'tags' => $self->tags, |
85
|
|
|
|
|
|
|
'title' => $self->login_title, |
86
|
|
|
|
|
|
|
); |
87
|
|
|
|
|
|
|
|
88
|
3
|
|
|
|
|
399
|
return; |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
sub _css { |
92
|
3
|
|
|
3
|
|
4
|
my $self = shift; |
93
|
|
|
|
|
|
|
|
94
|
3
|
|
|
|
|
12
|
$self->{'_page_begin'}->process_css; |
95
|
3
|
|
|
|
|
796
|
$self->{'_login_button'}->process_css; |
96
|
|
|
|
|
|
|
|
97
|
3
|
|
|
|
|
2585
|
return; |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
sub _tags { |
101
|
3
|
|
|
3
|
|
10
|
my $self = shift; |
102
|
|
|
|
|
|
|
|
103
|
3
|
|
|
|
|
8
|
$self->_css; |
104
|
|
|
|
|
|
|
|
105
|
3
|
|
|
|
|
15
|
$self->{'_page_begin'}->process; |
106
|
3
|
|
|
|
|
13232
|
$self->{'_login_button'}->process; |
107
|
3
|
|
|
|
|
4535
|
Tags::HTML::Page::End->new( |
108
|
|
|
|
|
|
|
'tags' => $self->tags, |
109
|
|
|
|
|
|
|
)->process; |
110
|
|
|
|
|
|
|
|
111
|
3
|
|
|
|
|
948
|
return; |
112
|
|
|
|
|
|
|
} |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
1; |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
__END__ |