| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Translate::Fluent::Elements::TermReference; |
|
2
|
|
|
|
|
|
|
|
|
3
|
6
|
|
|
6
|
|
43
|
use Moo; |
|
|
6
|
|
|
|
|
14
|
|
|
|
6
|
|
|
|
|
33
|
|
|
4
|
|
|
|
|
|
|
extends 'Translate::Fluent::Elements::Base'; |
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
has [qw( |
|
7
|
|
|
|
|
|
|
identifier |
|
8
|
|
|
|
|
|
|
attribute_accessor |
|
9
|
|
|
|
|
|
|
call_arguments |
|
10
|
|
|
|
|
|
|
)] => ( |
|
11
|
|
|
|
|
|
|
is => 'ro', |
|
12
|
|
|
|
|
|
|
default => sub { undef }, |
|
13
|
|
|
|
|
|
|
); |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
around BUILDARGS => sub { |
|
16
|
|
|
|
|
|
|
my ($orig, $class, %args) = @_; |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
$args{identifier} = delete $args{ Identifier }; |
|
19
|
|
|
|
|
|
|
$args{attribute_accessor} = delete $args{ AttributeAccessor }; |
|
20
|
|
|
|
|
|
|
$args{call_arguments} = delete $args{ CallArguments }; |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
$class->$orig( %args ); |
|
23
|
|
|
|
|
|
|
}; |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub translate { |
|
26
|
15
|
|
|
15
|
1
|
27
|
my ($self, $variables) = @_; |
|
27
|
|
|
|
|
|
|
|
|
28
|
15
|
|
|
|
|
47
|
my $res = $variables->{__resourceset}->get_term( $self->identifier ); |
|
29
|
15
|
50
|
|
|
|
36
|
return unless $res; |
|
30
|
|
|
|
|
|
|
|
|
31
|
15
|
100
|
|
|
|
40
|
if ($self->attribute_accessor) { |
|
32
|
9
|
|
|
|
|
31
|
$res = $res->get_attribute_resource( |
|
33
|
|
|
|
|
|
|
$self->attribute_accessor->identifier |
|
34
|
|
|
|
|
|
|
); |
|
35
|
|
|
|
|
|
|
} |
|
36
|
|
|
|
|
|
|
|
|
37
|
15
|
50
|
|
|
|
28
|
return unless $res; |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
my $vars = $self->call_arguments |
|
40
|
9
|
|
|
|
|
28
|
? { %{ $self->call_arguments->to_variables }, |
|
41
|
|
|
|
|
|
|
__resourceset => $variables->{__resourceset} |
|
42
|
|
|
|
|
|
|
} |
|
43
|
15
|
100
|
|
|
|
39
|
: $variables; |
|
44
|
|
|
|
|
|
|
|
|
45
|
15
|
|
|
|
|
54
|
return $res->translate( $vars ); |
|
46
|
|
|
|
|
|
|
} |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
1; |
|
49
|
|
|
|
|
|
|
__END__ |