line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Translate::Fluent::Elements::ArgumentList; |
2
|
|
|
|
|
|
|
|
3
|
6
|
|
|
6
|
|
42
|
use Moo; |
|
6
|
|
|
|
|
14
|
|
|
6
|
|
|
|
|
36
|
|
4
|
|
|
|
|
|
|
extends 'Translate::Fluent::Elements::Base'; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
has argument => ( |
7
|
|
|
|
|
|
|
is => 'ro', |
8
|
|
|
|
|
|
|
default => sub { [] }, |
9
|
|
|
|
|
|
|
); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
around BUILDARGS => sub { |
12
|
|
|
|
|
|
|
my ($orig, $self, %args) = @_; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
$args{ argument } = delete $args{ Argument }; |
15
|
|
|
|
|
|
|
$args{ argument } = [ $args{ argument } ] |
16
|
|
|
|
|
|
|
unless ref $args{argument} eq 'ARRAY'; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
$args{ argument } = [map { {Argument => $_ } } |
19
|
|
|
|
|
|
|
@{ $args{ argument } } ]; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
$self->$orig( %args ); |
22
|
|
|
|
|
|
|
}; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub to_variables { |
25
|
9
|
|
|
9
|
1
|
16
|
my ($self, $variables ) = @_; |
26
|
|
|
|
|
|
|
|
27
|
9
|
|
|
|
|
13
|
my %vars; |
28
|
|
|
|
|
|
|
|
29
|
9
|
|
|
|
|
14
|
my $pos = 0; |
30
|
9
|
|
50
|
|
|
13
|
for my $arg (@{ $self->argument // [] }) { |
|
9
|
|
|
|
|
30
|
|
31
|
15
|
|
|
|
|
41
|
my $id = $arg->identifier; |
32
|
15
|
100
|
|
|
|
29
|
unless ($id ) { |
33
|
3
|
|
|
|
|
7
|
$id = "position_$pos"; |
34
|
3
|
|
|
|
|
8
|
$pos++; |
35
|
|
|
|
|
|
|
} |
36
|
15
|
|
|
|
|
32
|
$vars{ $id } = $arg->translate( $variables ); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
9
|
|
|
|
|
46
|
return \%vars; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
1; |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
__END__ |