File Coverage

blib/lib/Tags/HTML/Login/Button.pm
Criterion Covered Total %
statement 30 30 100.0
branch n/a
condition n/a
subroutine 8 8 100.0
pod 1 1 100.0
total 39 39 100.0


line stmt bran cond sub pod time code
1             package Tags::HTML::Login::Button;
2              
3 5     5   115038 use base qw(Tags::HTML);
  5         30  
  5         1965  
4 5     5   74963 use strict;
  5         10  
  5         74  
5 5     5   20 use warnings;
  5         8  
  5         105  
6              
7 5     5   22 use Class::Utils qw(set_params split_params);
  5         7  
  5         166  
8 5     5   23 use Error::Pure qw(err);
  5         6  
  5         1331  
9              
10             our $VERSION = 0.01;
11              
12             # Constructor.
13             sub new {
14 9     9 1 7291 my ($class, @params) = @_;
15              
16             # Create object.
17 9         33 my ($object_params_ar, $other_params_ar) = split_params(
18             ['link', 'title'], @params);
19 9         258 my $self = $class->SUPER::new(@{$other_params_ar});
  9         39  
20              
21             # Login button link.
22 6         181 $self->{'link'} = 'login';
23              
24             # Login button title.
25 6         15 $self->{'title'} = 'LOGIN';
26              
27             # Process params.
28 6         11 set_params($self, @{$object_params_ar});
  6         20  
29              
30             # Object.
31 6         60 return $self;
32             }
33              
34             # Process 'Tags'.
35             sub _process {
36 2     2   17 my $self = shift;
37              
38             # Main content.
39             $self->{'tags'}->put(
40             ['a', 'class', 'outer'],
41              
42             ['b', 'div'],
43             ['a', 'class', 'login'],
44             ['b', 'a'],
45             ['a', 'href', $self->{'link'}],
46 2         16 ['d', $self->{'title'}],
47             ['e', 'a'],
48             ['e', 'div'],
49             );
50              
51 2         383 return;
52             }
53              
54             # Process 'CSS::Struct'.
55             sub _process_css {
56 1     1   12 my $self = shift;
57              
58 1         17 $self->{'css'}->put(
59             ['s', '.outer'],
60             ['d', 'position', 'fixed'],
61             ['d', 'top', '50%'],
62             ['d', 'left', '50%'],
63             ['d', 'transform', 'translate(-50%, -50%)'],
64             ['e'],
65              
66             ['s', '.login'],
67             ['d', 'text-align', 'center'],
68             ['d', 'background-color', 'blue'],
69             ['d', 'padding', '1em'],
70             ['e'],
71              
72             ['s', '.login a'],
73             ['d', 'text-decoration', 'none'],
74             ['d', 'color', 'white'],
75             ['d', 'font-size', '3em'],
76             ['e'],
77             );
78              
79 1         345 return;
80             }
81              
82             1;
83              
84             __END__