line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Tags::HTML::SendMessage; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
74647
|
use strict; |
|
2
|
|
|
|
|
11
|
|
|
2
|
|
|
|
|
60
|
|
4
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
54
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
1054
|
use Class::Utils qw(set_params); |
|
2
|
|
|
|
|
57607
|
|
|
2
|
|
|
|
|
35
|
|
7
|
2
|
|
|
2
|
|
140
|
use Error::Pure qw(err); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
73
|
|
8
|
2
|
|
|
2
|
|
11
|
use Readonly; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
1248
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
# Constants. |
11
|
|
|
|
|
|
|
Readonly::Hash my %LANG => ( |
12
|
|
|
|
|
|
|
'title' => 'Leave us a message', |
13
|
|
|
|
|
|
|
'name-and-surname' => 'Name and surname', |
14
|
|
|
|
|
|
|
'email' => 'Email', |
15
|
|
|
|
|
|
|
'subject' => 'Subject of you question', |
16
|
|
|
|
|
|
|
'your-message' => 'Your message', |
17
|
|
|
|
|
|
|
'send' => 'Send question', |
18
|
|
|
|
|
|
|
); |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
our $VERSION = 0.09; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
# Constructor. |
23
|
|
|
|
|
|
|
sub new { |
24
|
0
|
|
|
0
|
1
|
|
my ($class, @params) = @_; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
# Create object. |
27
|
0
|
|
|
|
|
|
my $self = bless {}, $class; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
# 'CSS::Struct' object. |
30
|
0
|
|
|
|
|
|
$self->{'css'} = undef; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
# Languages. |
33
|
0
|
|
|
|
|
|
$self->{'lang'} = \%LANG; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
# 'Tags' object. |
36
|
0
|
|
|
|
|
|
$self->{'tags'} = undef; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
# Process params. |
39
|
0
|
|
|
|
|
|
set_params($self, @params); |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
# Check to 'Tags' object. |
42
|
0
|
0
|
0
|
|
|
|
if (! $self->{'tags'} || ! $self->{'tags'}->isa('Tags::Output')) { |
43
|
0
|
|
|
|
|
|
err "Parameter 'tags' must be a 'Tags::Output::*' class."; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
# Check to 'CSS::Struct' object. |
47
|
0
|
0
|
0
|
|
|
|
if ($self->{'css'} && ! $self->{'css'}->isa('CSS::Struct::Output')) { |
48
|
0
|
|
|
|
|
|
err "Parameter 'css' must be a 'CSS::Struct::Output::*' class."; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
# Object. |
52
|
0
|
|
|
|
|
|
return $self; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
# Process 'Tags'. |
56
|
|
|
|
|
|
|
sub process { |
57
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
# Begin of page. |
60
|
|
|
|
|
|
|
$self->{'tags'}->put( |
61
|
|
|
|
|
|
|
['b', 'div'], |
62
|
|
|
|
|
|
|
['a', 'id', 'send-message'], |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
['b', 'form'], |
65
|
|
|
|
|
|
|
['a', 'action', ''], |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
['b', 'fieldset'], |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
['b', 'legend'], |
70
|
0
|
|
|
|
|
|
['d', $self->{'lang'}->{'title'}], |
71
|
|
|
|
|
|
|
['e', 'legend'], |
72
|
|
|
|
|
|
|
); |
73
|
0
|
|
|
|
|
|
$self->_tags_form_input('name-and-surname', 1, { 'size' => 30 }); |
74
|
0
|
|
|
|
|
|
$self->_tags_form_input('email', 1, { 'size' => 30 }); |
75
|
0
|
|
|
|
|
|
$self->_tags_form_input('subject', 1, { 'size' => 72 }); |
76
|
0
|
|
|
|
|
|
$self->_tags_form_textarea('your-message', 1, { 'cols' => 75, 'rows' => 10 }); |
77
|
|
|
|
|
|
|
$self->{'tags'}->put( |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
['b', 'input'], |
80
|
|
|
|
|
|
|
['a', 'type', 'submit'], |
81
|
0
|
|
|
|
|
|
['a', 'value', $self->{'lang'}->{'send'}], |
82
|
|
|
|
|
|
|
['e', 'input'], |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
['e', 'fieldset'], |
85
|
|
|
|
|
|
|
['e', 'form'], |
86
|
|
|
|
|
|
|
['e', 'div'], |
87
|
|
|
|
|
|
|
); |
88
|
|
|
|
|
|
|
|
89
|
0
|
|
|
|
|
|
return; |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
sub _tags_form_input { |
93
|
0
|
|
|
0
|
|
|
my ($self, $id, $br, $input_opts_hr) = @_; |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
$self->{'tags'}->put( |
96
|
|
|
|
|
|
|
['b', 'label'], |
97
|
|
|
|
|
|
|
['a', 'for', $id], |
98
|
|
|
|
|
|
|
['d', $self->{'lang'}->{$id}.':'], |
99
|
|
|
|
|
|
|
['e', 'label'], |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
['b', 'br'], |
102
|
|
|
|
|
|
|
['e', 'br'], |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
['b', 'input'], |
105
|
|
|
|
|
|
|
['a', 'id', $id], |
106
|
|
|
|
|
|
|
['a', 'name', $id], |
107
|
|
|
|
|
|
|
exists $input_opts_hr->{'size'} ? ( |
108
|
0
|
0
|
|
|
|
|
['a', 'size', $input_opts_hr->{'size'}], |
109
|
|
|
|
|
|
|
) : (), |
110
|
|
|
|
|
|
|
['e', 'input'], |
111
|
|
|
|
|
|
|
); |
112
|
0
|
0
|
|
|
|
|
if ($br) { |
113
|
0
|
|
|
|
|
|
$self->{'tags'}->put( |
114
|
|
|
|
|
|
|
['b', 'br'], |
115
|
|
|
|
|
|
|
['e', 'br'], |
116
|
|
|
|
|
|
|
); |
117
|
|
|
|
|
|
|
} |
118
|
|
|
|
|
|
|
|
119
|
0
|
|
|
|
|
|
return; |
120
|
|
|
|
|
|
|
} |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
sub _tags_form_textarea { |
123
|
0
|
|
|
0
|
|
|
my ($self, $id, $br, $textarea_opts_hr) = @_; |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
$self->{'tags'}->put( |
126
|
|
|
|
|
|
|
['b', 'label'], |
127
|
|
|
|
|
|
|
['a', 'for', $id], |
128
|
|
|
|
|
|
|
['d', $self->{'lang'}->{$id}.':'], |
129
|
|
|
|
|
|
|
['e', 'label'], |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
['b', 'br'], |
132
|
|
|
|
|
|
|
['e', 'br'], |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
['b', 'textarea'], |
135
|
|
|
|
|
|
|
['a', 'id', $id], |
136
|
|
|
|
|
|
|
['a', 'name', $id], |
137
|
|
|
|
|
|
|
exists $textarea_opts_hr->{'cols'} ? ( |
138
|
|
|
|
|
|
|
['a', 'cols', $textarea_opts_hr->{'cols'}], |
139
|
|
|
|
|
|
|
) : (), |
140
|
|
|
|
|
|
|
exists $textarea_opts_hr->{'rows'} ? ( |
141
|
0
|
0
|
|
|
|
|
['a', 'rows', $textarea_opts_hr->{'rows'}], |
|
|
0
|
|
|
|
|
|
142
|
|
|
|
|
|
|
) : (), |
143
|
|
|
|
|
|
|
['e', 'textarea'], |
144
|
|
|
|
|
|
|
); |
145
|
0
|
0
|
|
|
|
|
if ($br) { |
146
|
0
|
|
|
|
|
|
$self->{'tags'}->put( |
147
|
|
|
|
|
|
|
['b', 'br'], |
148
|
|
|
|
|
|
|
['e', 'br'], |
149
|
|
|
|
|
|
|
); |
150
|
|
|
|
|
|
|
} |
151
|
|
|
|
|
|
|
|
152
|
0
|
|
|
|
|
|
return; |
153
|
|
|
|
|
|
|
} |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
1; |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
__END__ |