line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTML::AsSubs; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# ABSTRACT: functions that construct a HTML syntax tree |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
74065
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
39
|
|
7
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
30
|
|
8
|
1
|
|
|
1
|
|
4
|
use vars qw(@ISA @EXPORT); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
135
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = '5.07'; # VERSION from OurPkgVersion |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
require HTML::Element; |
13
|
|
|
|
|
|
|
require Exporter; |
14
|
|
|
|
|
|
|
@ISA = qw(Exporter); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# Problem: exports so damned much. Has no concept of "export only HTML4 |
17
|
|
|
|
|
|
|
# elements". TODO:?? make something that make functions that just |
18
|
|
|
|
|
|
|
# wrap XML::Generator calls? |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
1
|
|
|
1
|
|
7
|
use vars qw(@TAGS); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
261
|
|
22
|
|
|
|
|
|
|
@TAGS = qw(html |
23
|
|
|
|
|
|
|
head title base link meta isindex nextid script style |
24
|
|
|
|
|
|
|
body h1 h2 h3 h4 h5 h6 p pre div blockquote |
25
|
|
|
|
|
|
|
a img br hr |
26
|
|
|
|
|
|
|
ol ul dir menu li |
27
|
|
|
|
|
|
|
dl dt dd |
28
|
|
|
|
|
|
|
dfn cite code em kbd samp strong var address span |
29
|
|
|
|
|
|
|
b i u tt |
30
|
|
|
|
|
|
|
center font big small strike |
31
|
|
|
|
|
|
|
sub sup |
32
|
|
|
|
|
|
|
table tr td th caption |
33
|
|
|
|
|
|
|
form input select option textarea |
34
|
|
|
|
|
|
|
object applet param |
35
|
|
|
|
|
|
|
map area |
36
|
|
|
|
|
|
|
frame frameset noframe |
37
|
|
|
|
|
|
|
); |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
for (@TAGS) { |
40
|
|
|
|
|
|
|
my $code; |
41
|
|
|
|
|
|
|
$code = "sub $_ { _elem('$_', \@_); }\n"; |
42
|
|
|
|
|
|
|
push( @EXPORT, $_ ); |
43
|
|
|
|
|
|
|
## no critic |
44
|
4
|
|
|
4
|
1
|
7165
|
eval $code; |
|
1
|
|
|
1
|
1
|
468
|
|
|
1
|
|
|
1
|
1
|
460
|
|
|
1
|
|
|
1
|
1
|
2170
|
|
|
1
|
|
|
1
|
1
|
465
|
|
|
1
|
|
|
1
|
1
|
501
|
|
|
1
|
|
|
1
|
1
|
464
|
|
|
1
|
|
|
1
|
1
|
490
|
|
|
1
|
|
|
1
|
1
|
477
|
|
|
1
|
|
|
1
|
1
|
504
|
|
|
1
|
|
|
1
|
1
|
500
|
|
|
1
|
|
|
1
|
1
|
501
|
|
|
1
|
|
|
1
|
1
|
463
|
|
|
1
|
|
|
1
|
1
|
482
|
|
|
1
|
|
|
1
|
1
|
471
|
|
|
1
|
|
|
1
|
1
|
462
|
|
|
1
|
|
|
1
|
1
|
461
|
|
|
1
|
|
|
1
|
1
|
490
|
|
|
1
|
|
|
1
|
1
|
496
|
|
|
1
|
|
|
1
|
1
|
495
|
|
|
1
|
|
|
1
|
1
|
496
|
|
|
1
|
|
|
1
|
1
|
461
|
|
|
1
|
|
|
1
|
1
|
469
|
|
|
1
|
|
|
1
|
1
|
2296
|
|
|
1
|
|
|
1
|
1
|
2320
|
|
|
1
|
|
|
1
|
1
|
465
|
|
|
1
|
|
|
1
|
1
|
464
|
|
|
1
|
|
|
1
|
1
|
478
|
|
|
1
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
|
|
|
1
|
|
|
1
|
1
|
465
|
|
45
|
|
|
|
|
|
|
## use critic |
46
|
|
|
|
|
|
|
if ($@) { |
47
|
|
|
|
|
|
|
die $@; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub _elem { |
53
|
75
|
|
|
75
|
|
161
|
my $tag = shift; |
54
|
75
|
|
|
|
|
122
|
my $attributes; |
55
|
75
|
100
|
100
|
|
|
446
|
if ( @_ and defined $_[0] and ref( $_[0] ) eq "HASH" ) { |
|
|
|
100
|
|
|
|
|
56
|
1
|
|
|
|
|
7
|
$attributes = shift; |
57
|
|
|
|
|
|
|
} |
58
|
75
|
|
|
|
|
358
|
my $elem = HTML::Element->new( $tag, %$attributes ); |
59
|
75
|
|
|
|
|
308
|
$elem->push_content(@_); |
60
|
75
|
|
|
|
|
606
|
$elem; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
1; |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
__END__ |