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