File Coverage

blib/lib/Plack/App/Login.pm
Criterion Covered Total %
statement 33 33 100.0
branch 8 8 100.0
condition n/a
subroutine 8 8 100.0
pod n/a
total 49 49 100.0


line stmt bran cond sub pod time code
1             package Plack::App::Login;
2              
3 4     4   152336 use base qw(Plack::Component::Tags::HTML);
  4         25  
  4         2062  
4 4     4   287975 use strict;
  4         11  
  4         83  
5 4     4   25 use warnings;
  4         16  
  4         118  
6              
7 4     4   21 use Plack::Util::Accessor qw(generator login_link login_title title);
  4         9  
  4         28  
8 4     4   2168 use Tags::HTML::Login::Button;
  4         2392  
  4         919  
9              
10             our $VERSION = 0.08;
11              
12             sub _css {
13 3     3   804 my $self = shift;
14              
15 3         12 $self->{'_login_button'}->process_css;
16              
17 3         2545 return;
18             }
19              
20             sub _prepare_app {
21 5     5   32927 my $self = shift;
22              
23             # Defaults which rewrite defaults in module which I am inheriting.
24 5 100       19 if (! $self->generator) {
25 4         96 $self->generator(__PACKAGE__.'; Version: '.$VERSION);
26             }
27              
28 5 100       45 if (! $self->title) {
29 4         24 $self->title('Login page');
30             }
31              
32             # Inherite defaults.
33 5         40 $self->SUPER::_prepare_app;
34              
35             # Defaults from this module.
36 3 100       1878 if (! $self->login_link) {
37 2         14 $self->login_link('login');
38             }
39              
40 3 100       20 if (! $self->login_title) {
41 2         12 $self->login_title('LOGIN');
42             }
43              
44             # Tags helper for login button.
45             $self->{'_login_button'} = Tags::HTML::Login::Button->new(
46             'css' => $self->{'css'},
47             'link' => $self->login_link,
48 3         20 'tags' => $self->{'tags'},
49             'title' => $self->login_title,
50             );
51              
52 3         386 return;
53             }
54              
55             sub _tags_middle {
56 3     3   12926 my $self = shift;
57              
58 3         46 $self->{'_login_button'}->process;
59              
60 3         4548 return;
61             }
62              
63             1;
64              
65             __END__