line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Tags::Element; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
58389
|
use base qw(Exporter); |
|
3
|
|
|
|
|
14
|
|
|
3
|
|
|
|
|
300
|
|
4
|
3
|
|
|
3
|
|
17
|
use strict; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
56
|
|
5
|
3
|
|
|
3
|
|
10
|
use warnings; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
82
|
|
6
|
|
|
|
|
|
|
|
7
|
3
|
|
|
3
|
|
1274
|
use Readonly; |
|
3
|
|
|
|
|
9309
|
|
|
3
|
|
|
|
|
502
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# Constants. |
10
|
|
|
|
|
|
|
Readonly::Array our @EXPORT_OK => qw(element); |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# Version. |
13
|
|
|
|
|
|
|
our $VERSION = 0.03; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# Common element. |
16
|
|
|
|
|
|
|
sub element { |
17
|
8
|
|
|
8
|
1
|
7143
|
my ($element, @data) = @_; |
18
|
8
|
|
|
|
|
14
|
my @attr; |
19
|
|
|
|
|
|
|
my @content; |
20
|
8
|
|
|
|
|
13
|
foreach my $ref (@data) { |
21
|
10
|
100
|
|
|
|
25
|
if (ref $ref eq 'HASH') { |
|
|
100
|
|
|
|
|
|
22
|
4
|
|
|
|
|
7
|
foreach my $key (sort keys %{$ref}) { |
|
4
|
|
|
|
|
10
|
|
23
|
3
|
|
|
|
|
10
|
push @attr, ['a', $key, $ref->{$key}]; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
} elsif (ref $ref eq 'ARRAY') { |
26
|
3
|
|
|
|
|
4
|
push @content, @{$ref}; |
|
3
|
|
|
|
|
7
|
|
27
|
|
|
|
|
|
|
} else { |
28
|
3
|
|
|
|
|
6
|
push @content, ['d', $ref]; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
return ( |
32
|
8
|
100
|
|
|
|
65
|
['b', $element], |
|
|
100
|
|
|
|
|
|
33
|
|
|
|
|
|
|
@attr ? @attr : (), |
34
|
|
|
|
|
|
|
@content ? @content : (), |
35
|
|
|
|
|
|
|
['e', $element], |
36
|
|
|
|
|
|
|
); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
1; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
__END__ |