| 1 | package Plack::App::Restricted; | ||
| 2 | |||
| 3 | 2 | ▶ | use base qw(Plack::Component::Tags::HTML); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | use strict; | ||
| 5 | use warnings; | ||
| 6 | |||
| 7 | use Plack::Util::Accessor qw(label); | ||
| 8 | use Tags::HTML::Container; | ||
| 9 | |||
| 10 | our $VERSION = 0.01; | ||
| 11 | |||
| 12 | sub _css { | ||
| 13 | my ($self, $env) = @_; | ||
| 14 | |||
| 15 | $self->{'_tags_html_container'}->process_css; | ||
| 16 | |||
| 17 | $self->{'css'}->put( | ||
| 18 | ['s', '.restricted'], | ||
| 19 | ['d', 'color', 'red'], | ||
| 20 | ['d', 'font-family', 'sans-serif'], | ||
| 21 | ['d', 'font-size', '3em'], | ||
| 22 | ['e'], | ||
| 23 | ); | ||
| 24 | |||
| 25 | return; | ||
| 26 | } | ||
| 27 | |||
| 28 | sub _prepare_app { | ||
| 29 | my $self = shift; | ||
| 30 | |||
| 31 | # Inherite defaults. | ||
| 32 | $self->SUPER::_prepare_app; | ||
| 33 | |||
| 34 | if (! defined $self->label) { | ||
| 35 | $self->label('Restricted access'); | ||
| 36 | } | ||
| 37 | |||
| 38 | $self->{'_tags_html_container'} = Tags::HTML::Container->new( | ||
| 39 | 'css' => $self->css, | ||
| 40 | 'tags' => $self->tags, | ||
| 41 | ); | ||
| 42 | |||
| 43 | return; | ||
| 44 | } | ||
| 45 | |||
| 46 | sub _tags_middle { | ||
| 47 | my ($self, $env) = @_; | ||
| 48 | |||
| 49 | my $label = $self->label; | ||
| 50 | $self->{'_tags_html_container'}->process( | ||
| 51 | sub { | ||
| 52 | my $self = shift; | ||
| 53 | |||
| 54 | $self->{'tags'}->put( | ||
| 55 | ['b', 'div'], | ||
| 56 | ['a', 'class', 'restricted'], | ||
| 57 | ['d', $label], | ||
| 58 | ['e', 'div'], | ||
| 59 | ); | ||
| 60 | |||
| 61 | return; | ||
| 62 | }, | ||
| 63 | ); | ||
| 64 | |||
| 65 | return; | ||
| 66 | } | ||
| 67 | |||
| 68 | |||
| 69 | 1; | ||
| 70 | |||
| 71 | __END__ | ||