line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTML::GUI::tag; |
2
|
|
|
|
|
|
|
|
3
|
13
|
|
|
13
|
|
82
|
use warnings; |
|
13
|
|
|
|
|
28
|
|
|
13
|
|
|
|
|
626
|
|
4
|
13
|
|
|
13
|
|
69
|
use strict; |
|
13
|
|
|
|
|
91
|
|
|
13
|
|
|
|
|
6138
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
=head1 NAME |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
HTML::GUI::tag - generate html tags |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 VERSION |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
Version 0.01 |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=cut |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 TAG |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
abstract class for generating html. |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=cut |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=pod |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head1 PUBLIC METHODS |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=pod |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head3 new |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=cut |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub new |
40
|
|
|
|
|
|
|
{ |
41
|
0
|
|
|
0
|
1
|
|
my($class |
42
|
|
|
|
|
|
|
) = @_; |
43
|
|
|
|
|
|
|
|
44
|
0
|
|
|
|
|
|
my $this = {}; |
45
|
|
|
|
|
|
|
|
46
|
0
|
|
|
|
|
|
bless($this, $class); |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head3 escapeHtml |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
Description : |
54
|
|
|
|
|
|
|
return the protected label with : |
55
|
|
|
|
|
|
|
- " instead of " |
56
|
|
|
|
|
|
|
- & insterad of & |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=cut |
59
|
|
|
|
|
|
|
sub escapeHtml($$){ |
60
|
0
|
|
|
0
|
1
|
|
my ($self,$label)=@_; |
61
|
0
|
|
|
|
|
|
$label =~ s/&/&/g; |
62
|
0
|
|
|
|
|
|
$label =~ s/"/"/g; |
63
|
0
|
|
|
|
|
|
$label =~ s/</g; |
64
|
0
|
|
|
|
|
|
$label =~ s/>/>/g; |
65
|
0
|
|
|
|
|
|
return $label |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=pod |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head3 getHtmlTag |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
Parameters : |
74
|
|
|
|
|
|
|
tagName : string : Name of the tag to generate |
75
|
|
|
|
|
|
|
@htmlProperties : array : Array of hash ref of properties for the tag (propName => propValue) |
76
|
|
|
|
|
|
|
content : string : Content of the HTML tag. The content string is inserted "as is" in the tag, it should not contain special characters like '&' or '<' except for coding entities or inner tags. |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
Return : |
80
|
|
|
|
|
|
|
string |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
Description : |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=cut |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
sub getHtmlTag |
88
|
|
|
|
|
|
|
{ |
89
|
0
|
|
|
0
|
1
|
|
my($self, |
90
|
|
|
|
|
|
|
$tagName, # string : Name of the tag to generate |
91
|
|
|
|
|
|
|
$tagProperties, # array : hash ref of properties for the tag (propName => propValue) |
92
|
|
|
|
|
|
|
$content, # string : Content of the HTML tag. |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
) = @_; |
95
|
0
|
|
|
|
|
|
my @widgetProp = (); |
96
|
0
|
|
|
|
|
|
my @propNames = (); |
97
|
0
|
|
|
|
|
|
@propNames = keys %$tagProperties; |
98
|
0
|
|
|
|
|
|
@propNames = sort {$a cmp $b} @propNames; #always the same order |
|
0
|
|
|
|
|
|
|
99
|
0
|
|
|
|
|
|
foreach my $propName (@propNames){ |
100
|
0
|
0
|
|
|
|
|
if ($tagProperties->{$propName} ne ""){ |
101
|
0
|
|
|
|
|
|
push @widgetProp, |
102
|
|
|
|
|
|
|
$propName.'="'.$self->escapeHtml($tagProperties->{$propName}).'"'; |
103
|
|
|
|
|
|
|
} |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
} |
106
|
0
|
|
|
|
|
|
my $tagHtml = join ' ',$tagName,@widgetProp; |
107
|
0
|
0
|
|
|
|
|
if ($content){ |
108
|
0
|
|
|
|
|
|
return '<'.$tagHtml.'>' |
109
|
|
|
|
|
|
|
.$content |
110
|
|
|
|
|
|
|
.''.$tagName.'>'; |
111
|
|
|
|
|
|
|
}else{ |
112
|
0
|
|
|
|
|
|
return '<'.$tagHtml.'/>'; |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
} |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=head1 AUTHOR |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
Jean-Christian Hassler, C<< >> |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=head1 BUGS |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
Please report any bugs or feature requests to |
124
|
|
|
|
|
|
|
C, or through the web interface at |
125
|
|
|
|
|
|
|
L. |
126
|
|
|
|
|
|
|
I will be notified, and then you'll automatically be notified of progress on |
127
|
|
|
|
|
|
|
your bug as I make changes. |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=head1 SUPPORT |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
perldoc HTML::GUI::widget |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
You can also look for information at: |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=over 4 |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
L |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=item * CPAN Ratings |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
L |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
L |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=item * Search CPAN |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
L |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
=back |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
Copyright 2007 Jean-Christian Hassler, all rights reserved. |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
164
|
|
|
|
|
|
|
under the same terms as Perl itself. |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
=cut |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
1; # End of HTML::GUI::tag |