| 1 | package Plack::App::Login; | ||||||||||
| 2 | |||||||||||
| 3 | 4 | ▶ | use base qw(Plack::Component::Tags::HTML); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 4 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 4 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 4 | ▶ | use Plack::Util::Accessor qw(generator login_link login_title title); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 4 | ▶ | use Tags::HTML::Login::Button; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | |||||||||||
| 10 | 4 | our $VERSION = 0.08; | |||||||||
| 11 | |||||||||||
| 12 | 3 | ▶ | sub _css { | ||||||||
|
Subroutine
_css: called CC=1 SCAR=0.0
| |||||||||||
| 13 | 3 | my $self = shift; | |||||||||
| 14 | |||||||||||
| 15 | 3 | $self->{'_login_button'}->process_css; | |||||||||
| 16 | |||||||||||
| 17 | 3 | return; | |||||||||
| 18 | } | ||||||||||
| 19 | |||||||||||
| 20 | 5 | ▶ | sub _prepare_app { | ||||||||
|
Subroutine
_prepare_app: called CC=5 SCAR=16.1
| |||||||||||
| 21 | 5 | my $self = shift; | |||||||||
| 22 | |||||||||||
| 23 | # Defaults which rewrite defaults in module which I am inheriting. | ||||||||||
| 24 | 5 | ▶ | if (! $self->generator) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 25 | 4 | $self->generator(__PACKAGE__.'; Version: '.$VERSION); | |||||||||
| 26 | } | ||||||||||
| 27 | |||||||||||
| 28 | 5 | ▶ | if (! $self->title) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 29 | 4 | $self->title('Login page'); | |||||||||
| 30 | } | ||||||||||
| 31 | |||||||||||
| 32 | # Inherite defaults. | ||||||||||
| 33 | 5 | $self->SUPER::_prepare_app; | |||||||||
| 34 | |||||||||||
| 35 | # Defaults from this module. | ||||||||||
| 36 | 3 | ▶ | if (! $self->login_link) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 37 | 2 | $self->login_link('login'); | |||||||||
| 38 | } | ||||||||||
| 39 | |||||||||||
| 40 | 3 | ▶ | if (! $self->login_title) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 41 | 2 | $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 | 'tags' => $self->{'tags'}, | |||||||||
| 49 | 'title' => $self->login_title, | ||||||||||
| 50 | ); | ||||||||||
| 51 | |||||||||||
| 52 | 3 | return; | |||||||||
| 53 | } | ||||||||||
| 54 | |||||||||||
| 55 | 3 | ▶ | sub _tags_middle { | ||||||||
|
Subroutine
_tags_middle: called CC=1 SCAR=0.0
| |||||||||||
| 56 | 3 | my $self = shift; | |||||||||
| 57 | |||||||||||
| 58 | 3 | $self->{'_login_button'}->process; | |||||||||
| 59 | |||||||||||
| 60 | 3 | return; | |||||||||
| 61 | } | ||||||||||
| 62 | |||||||||||
| 63 | 4 | 1; | |||||||||
| 64 | |||||||||||
| 65 | __END__ | ||||||||||