line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Plack::App::Login; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
133342
|
use base qw(Plack::Component); |
|
4
|
|
|
|
|
26
|
|
|
4
|
|
|
|
|
1770
|
|
4
|
4
|
|
|
4
|
|
43460
|
use strict; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
67
|
|
5
|
4
|
|
|
4
|
|
17
|
use warnings; |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
92
|
|
6
|
|
|
|
|
|
|
|
7
|
4
|
|
|
4
|
|
1834
|
use CSS::Struct::Output::Raw; |
|
4
|
|
|
|
|
75256
|
|
|
4
|
|
|
|
|
131
|
|
8
|
4
|
|
|
4
|
|
30
|
use Error::Pure qw(err); |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
166
|
|
9
|
4
|
|
|
4
|
|
1827
|
use Plack::Util::Accessor qw(css generator login_link login_title tags title); |
|
4
|
|
|
|
|
941
|
|
|
4
|
|
|
|
|
27
|
|
10
|
4
|
|
|
4
|
|
270
|
use Scalar::Util qw(blessed); |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
157
|
|
11
|
4
|
|
|
4
|
|
1717
|
use Tags::HTML::Login::Button; |
|
4
|
|
|
|
|
5508
|
|
|
4
|
|
|
|
|
103
|
|
12
|
4
|
|
|
4
|
|
1717
|
use Tags::HTML::Page::Begin; |
|
4
|
|
|
|
|
8058
|
|
|
4
|
|
|
|
|
119
|
|
13
|
4
|
|
|
4
|
|
1901
|
use Tags::HTML::Page::End; |
|
4
|
|
|
|
|
1007
|
|
|
4
|
|
|
|
|
90
|
|
14
|
4
|
|
|
4
|
|
1703
|
use Tags::Output::Raw; |
|
4
|
|
|
|
|
103804
|
|
|
4
|
|
|
|
|
145
|
|
15
|
4
|
|
|
4
|
|
1825
|
use Unicode::UTF8 qw(decode_utf8 encode_utf8); |
|
4
|
|
|
|
|
1734
|
|
|
4
|
|
|
|
|
1763
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
our $VERSION = 0.06; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub call { |
20
|
3
|
|
|
3
|
1
|
41
|
my ($self, $env) = @_; |
21
|
|
|
|
|
|
|
|
22
|
3
|
|
|
|
|
8
|
$self->_tags; |
23
|
3
|
|
|
|
|
8
|
$self->tags->finalize; |
24
|
3
|
|
|
|
|
41
|
my $content = encode_utf8($self->tags->flush(1)); |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
return [ |
27
|
3
|
|
|
|
|
423
|
200, |
28
|
|
|
|
|
|
|
[ |
29
|
|
|
|
|
|
|
'content-type' => 'text/html; charset=utf-8', |
30
|
|
|
|
|
|
|
], |
31
|
|
|
|
|
|
|
[$content], |
32
|
|
|
|
|
|
|
]; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub prepare_app { |
36
|
5
|
|
|
5
|
1
|
26656
|
my $self = shift; |
37
|
|
|
|
|
|
|
|
38
|
5
|
100
|
|
|
|
18
|
if ($self->css) { |
39
|
3
|
100
|
66
|
|
|
48
|
if (! blessed($self->css) || ! $self->css->isa('CSS::Struct::Output')) { |
40
|
1
|
|
|
|
|
11
|
err "Bad 'CSS::Struct::Output' object."; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
} else { |
43
|
2
|
|
|
|
|
33
|
$self->css(CSS::Struct::Output::Raw->new); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
4
|
100
|
|
|
|
217
|
if ($self->tags) { |
47
|
3
|
100
|
66
|
|
|
16
|
if (! blessed($self->tags) || ! $self->tags->isa('Tags::Output')) { |
48
|
1
|
|
|
|
|
8
|
err "Bad 'Tags::Output' object."; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
} else { |
51
|
1
|
|
|
|
|
11
|
$self->tags(Tags::Output::Raw->new('xml' => 1)); |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
3
|
100
|
|
|
|
197
|
if (! $self->generator) { |
55
|
2
|
|
|
|
|
19
|
$self->generator(__PACKAGE__.'; Version: '.$VERSION); |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
3
|
100
|
|
|
|
15
|
if (! $self->title) { |
59
|
2
|
|
|
|
|
9
|
$self->title('Login page'); |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
3
|
100
|
|
|
|
14
|
if (! $self->login_link) { |
63
|
2
|
|
|
|
|
10
|
$self->login_link('login'); |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
3
|
100
|
|
|
|
13
|
if (! $self->login_title) { |
67
|
2
|
|
|
|
|
8
|
$self->login_title('LOGIN'); |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
# Tags helper for login button. |
71
|
3
|
|
|
|
|
14
|
$self->{'_login_button'} = Tags::HTML::Login::Button->new( |
72
|
|
|
|
|
|
|
'css' => $self->css, |
73
|
|
|
|
|
|
|
'link' => $self->login_link, |
74
|
|
|
|
|
|
|
'tags' => $self->tags, |
75
|
|
|
|
|
|
|
'title' => $self->login_title, |
76
|
|
|
|
|
|
|
); |
77
|
|
|
|
|
|
|
|
78
|
3
|
|
|
|
|
355
|
return; |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
sub _css { |
82
|
3
|
|
|
3
|
|
3
|
my $self = shift; |
83
|
|
|
|
|
|
|
|
84
|
3
|
|
|
|
|
11
|
$self->{'_login_button'}->process_css; |
85
|
|
|
|
|
|
|
|
86
|
3
|
|
|
|
|
2201
|
return; |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
sub _tags { |
90
|
3
|
|
|
3
|
|
4
|
my $self = shift; |
91
|
|
|
|
|
|
|
|
92
|
3
|
|
|
|
|
7
|
$self->_css; |
93
|
|
|
|
|
|
|
|
94
|
3
|
|
|
|
|
9
|
Tags::HTML::Page::Begin->new( |
95
|
|
|
|
|
|
|
'css' => $self->css, |
96
|
|
|
|
|
|
|
'generator' => $self->generator, |
97
|
|
|
|
|
|
|
'lang' => { |
98
|
|
|
|
|
|
|
'title' => $self->title, |
99
|
|
|
|
|
|
|
}, |
100
|
|
|
|
|
|
|
'tags' => $self->tags, |
101
|
|
|
|
|
|
|
)->process; |
102
|
3
|
|
|
|
|
10966
|
$self->{'_login_button'}->process; |
103
|
3
|
|
|
|
|
3729
|
Tags::HTML::Page::End->new( |
104
|
|
|
|
|
|
|
'tags' => $self->tags, |
105
|
|
|
|
|
|
|
)->process; |
106
|
|
|
|
|
|
|
|
107
|
3
|
|
|
|
|
770
|
return; |
108
|
|
|
|
|
|
|
} |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
1; |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
__END__ |