line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Copyright (C) 2017 Koha-Suomi |
2
|
|
|
|
|
|
|
# |
3
|
|
|
|
|
|
|
# This file is part of Pootle-Client. |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Pootle::Resource::Unit; |
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
268
|
use Modern::Perl '2015'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
8
|
1
|
|
|
1
|
|
90
|
use utf8; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
9
|
|
|
|
|
|
|
binmode STDOUT, ':encoding(UTF-8)'; |
10
|
|
|
|
|
|
|
binmode STDERR, ':encoding(UTF-8)'; |
11
|
1
|
|
|
1
|
|
30
|
use feature 'signatures'; no warnings "experimental::signatures"; |
|
1
|
|
|
1
|
|
1
|
|
|
1
|
|
|
|
|
22
|
|
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
22
|
|
12
|
1
|
|
|
1
|
|
4
|
use Carp::Always; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
22
|
|
13
|
1
|
|
|
1
|
|
4
|
use Try::Tiny; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
39
|
|
14
|
1
|
|
|
1
|
|
5
|
use Scalar::Util qw(blessed); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
35
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head2 Pootle::Resource::Unit |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
Pootle object |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=cut |
21
|
|
|
|
|
|
|
|
22
|
1
|
|
|
1
|
|
4
|
use base('Pootle::Resource'); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
95
|
|
23
|
|
|
|
|
|
|
|
24
|
1
|
|
|
1
|
|
5
|
use Params::Validate qw(:all); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
109
|
|
25
|
|
|
|
|
|
|
|
26
|
1
|
|
|
1
|
|
5
|
use Pootle::Logger; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
27
|
|
|
|
|
|
|
my $l = bless({}, 'Pootle::Logger'); #Lazy load package logger this way to avoid circular dependency issues with logger includes from many packages |
28
|
|
|
|
|
|
|
|
29
|
0
|
|
|
0
|
0
|
|
sub new($class, @params) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
30
|
0
|
0
|
|
|
|
|
$l->debug("Initializing ".__PACKAGE__." with parameters: ".$l->flatten(@params)) if $l->is_debug(); |
31
|
0
|
|
|
|
|
|
my %self = validate(@params, { |
32
|
|
|
|
|
|
|
commented_by => 0, #eg. null |
33
|
|
|
|
|
|
|
commented_on => 1, #eg. "2013-03-15T20:10:35.017844", |
34
|
|
|
|
|
|
|
context => 1, #eg. "This is a phrase, not a verb.", |
35
|
|
|
|
|
|
|
developer_comment => 1, #eg. "Translators: name of the option in the menu.", |
36
|
|
|
|
|
|
|
locations => 1, #eg. "fr/firefox/chrome/global/languageNames.properties.po:62", |
37
|
|
|
|
|
|
|
mtime => 1, #eg. 2013-05-12T17:51:49.786611", |
38
|
|
|
|
|
|
|
resource_uri => 1, #eg. "/api/v1/units/70316/", |
39
|
|
|
|
|
|
|
source_f => 1, #eg. "New Tab", |
40
|
|
|
|
|
|
|
source_length => 1, #eg. 29, |
41
|
|
|
|
|
|
|
source_wordcount => 1, #eg. 3, |
42
|
|
|
|
|
|
|
state => 1, #eg. 0, |
43
|
|
|
|
|
|
|
store => 1, #eg. "/api/v1/stores/76/", |
44
|
|
|
|
|
|
|
submitted_by => 0, #eg. "/api/v1/users/3/", |
45
|
|
|
|
|
|
|
submitted_on => 1, #eg. "2013-05-21T17:51:16.155000", |
46
|
|
|
|
|
|
|
suggestions => { type => ARRAYREF }, #eg. ["/api/v1/suggestions/1/", ...] |
47
|
|
|
|
|
|
|
target_f => 1, #eg. "", |
48
|
|
|
|
|
|
|
target_length => 1, #eg. 0, |
49
|
|
|
|
|
|
|
target_wordcount => 1, #eg. 0, |
50
|
|
|
|
|
|
|
translator_comment => 1, #eg. "" |
51
|
|
|
|
|
|
|
}); |
52
|
0
|
|
|
|
|
|
my $s = bless(\%self, $class); |
53
|
|
|
|
|
|
|
|
54
|
0
|
|
|
|
|
|
return $s; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
0
|
|
|
0
|
1
|
|
sub commented_by($s) { return $s->{commented_by} } |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
58
|
0
|
|
|
0
|
1
|
|
sub commented_on($s) { return $s->{commented_on} } |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
59
|
0
|
|
|
0
|
1
|
|
sub context($s) { return $s->{context} } |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
60
|
0
|
|
|
0
|
1
|
|
sub developer_comment($s) { return $s->{developer_comment} } |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
61
|
0
|
|
|
0
|
1
|
|
sub locations($s) { return $s->{locations} } |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
62
|
0
|
|
|
0
|
1
|
|
sub mtime($s) { return $s->{mtime} } |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
63
|
0
|
|
|
0
|
1
|
|
sub resource_uri($s) { return $s->{resource_uri} } |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
64
|
0
|
|
|
0
|
1
|
|
sub source_f($s) { return $s->{source_f} } |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
65
|
0
|
|
|
0
|
1
|
|
sub source_length($s) { return $s->{source_length} } |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
66
|
0
|
|
|
0
|
1
|
|
sub source_wordcount($s) { return $s->{source_wordcount} } |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
67
|
0
|
|
|
0
|
1
|
|
sub state($s) { return $s->{state} } |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
68
|
0
|
|
|
0
|
1
|
|
sub store($s) { return $s->{store} } |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
69
|
0
|
|
|
0
|
1
|
|
sub submitted_by($s) { return $s->{submitted_by} } |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
70
|
0
|
|
|
0
|
1
|
|
sub submitted_on($s) { return $s->{submitted_on} } |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
71
|
0
|
|
|
0
|
1
|
|
sub suggestions($s) { return $s->{suggestions} } |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
72
|
0
|
|
|
0
|
1
|
|
sub target_f($s) { return $s->{target_f} } |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
73
|
0
|
|
|
0
|
1
|
|
sub target_length($s) { return $s->{target_length} } |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
74
|
0
|
|
|
0
|
1
|
|
sub target_wordcount($s) { return $s->{target_wordcount} } |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
75
|
0
|
|
|
0
|
1
|
|
sub translator_comment($s) { return $s->{translator_comment} } |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head2 Accessors |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=over 4 |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=item B |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=item B |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=item B |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=item B |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=item B |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=item B |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=item B |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=item B |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=item B |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=item B |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=item B |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=item B |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=item B |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=item B |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=item B |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=item B |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=item B |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=item B |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=item B |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=cut |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
1; |