line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Translate::Fluent::Elements::Base; |
2
|
|
|
|
|
|
|
|
3
|
6
|
|
|
6
|
|
3005
|
use Moo; |
|
6
|
|
|
|
|
13
|
|
|
6
|
|
|
|
|
34
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
around BUILDARGS => sub { |
6
|
|
|
|
|
|
|
my ($orig, $class, @args) = @_; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
my %args = ref $args[0] ? %{ $args[0] } : @args; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
for my $k (keys %args) { |
11
|
|
|
|
|
|
|
my $val = delete $args{ $k }; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
if (ref $val eq 'HASH') { |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
my $res = Translate::Fluent::Elements->create( |
16
|
|
|
|
|
|
|
$k, $val |
17
|
|
|
|
|
|
|
); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
$val = $res if $res; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
} elsif (ref $val eq 'ARRAY') { |
22
|
|
|
|
|
|
|
my @items; |
23
|
|
|
|
|
|
|
for my $item ( @$val ) { |
24
|
|
|
|
|
|
|
my ($type) = keys %$item; |
25
|
|
|
|
|
|
|
my $itemval = ref $item->{$type} |
26
|
|
|
|
|
|
|
? $item->{$type} |
27
|
|
|
|
|
|
|
: { text => $item->{$type} }; |
28
|
|
|
|
|
|
|
my $res = Translate::Fluent::Elements->create( |
29
|
|
|
|
|
|
|
$type => $itemval |
30
|
|
|
|
|
|
|
); |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
push @items, $res ? $res : $item; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
$val = \@items; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
$args{ "\L$k" } = $val; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
return $class->$orig( %args ); |
42
|
|
|
|
|
|
|
}; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
1; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
__END__ |