line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Translate::Fluent::Elements::Pattern; |
2
|
|
|
|
|
|
|
|
3
|
6
|
|
|
6
|
|
47
|
use Moo; |
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
35
|
|
4
|
|
|
|
|
|
|
extends 'Translate::Fluent::Elements::Base'; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
has [qw(pattern_element)] => ( |
7
|
|
|
|
|
|
|
is => 'ro', |
8
|
|
|
|
|
|
|
default => sub { undef }, |
9
|
|
|
|
|
|
|
); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
around BUILDARGS => sub { |
12
|
|
|
|
|
|
|
my ($orig, $class, %args) = @_; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
$args{Pattern_Element} = delete $args{PatternElement}; |
15
|
|
|
|
|
|
|
$args{Pattern_Element} = [ $args{Pattern_Element} ] |
16
|
|
|
|
|
|
|
unless ref $args{Pattern_Element} eq 'ARRAY'; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
$class->$orig( %args ); |
19
|
|
|
|
|
|
|
}; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub translate { |
22
|
45
|
|
|
45
|
1
|
72
|
my ($self, $variables) = @_; |
23
|
|
|
|
|
|
|
|
24
|
45
|
|
|
|
|
60
|
my $res = ''; |
25
|
45
|
|
|
|
|
57
|
for my $elem (@{ $self->pattern_element }) { |
|
45
|
|
|
|
|
105
|
|
26
|
90
|
|
|
|
|
206
|
$res .= $elem->translate( $variables ); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
45
|
|
|
|
|
217
|
return $res; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
1; |
33
|
|
|
|
|
|
|
__END__ |