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::TranslationProject; |
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
275
|
use Modern::Perl '2015'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
5
|
|
8
|
1
|
|
|
1
|
|
92
|
use utf8; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
3
|
|
9
|
|
|
|
|
|
|
binmode STDOUT, ':encoding(UTF-8)'; |
10
|
|
|
|
|
|
|
binmode STDERR, ':encoding(UTF-8)'; |
11
|
1
|
|
|
1
|
|
31
|
use feature 'signatures'; no warnings "experimental::signatures"; |
|
1
|
|
|
1
|
|
2
|
|
|
1
|
|
|
|
|
22
|
|
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
22
|
|
12
|
1
|
|
|
1
|
|
4
|
use Carp::Always; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
19
|
|
13
|
1
|
|
|
1
|
|
6
|
use Try::Tiny; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
43
|
|
14
|
1
|
|
|
1
|
|
29
|
use Scalar::Util qw(blessed); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
37
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head2 Pootle::Resource::TranslationProject |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
Pootle object |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=cut |
21
|
|
|
|
|
|
|
|
22
|
1
|
|
|
1
|
|
4
|
use base('Pootle::Resource'); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
78
|
|
23
|
|
|
|
|
|
|
|
24
|
1
|
|
|
1
|
|
6
|
use Params::Validate qw(:all); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
119
|
|
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
|
|
|
|
|
|
|
description => 1, #eg. "" |
33
|
|
|
|
|
|
|
language => 1, #eg. "/api/v1/languages/110/" |
34
|
|
|
|
|
|
|
pootle_path => 1, #eg. "/fr/Firefox/" |
35
|
|
|
|
|
|
|
project => 1, #eg. "/api/v1/projects/3/" |
36
|
|
|
|
|
|
|
real_path => 1, #eg. "Firefox/fr" |
37
|
|
|
|
|
|
|
resource_uri => 1, #eg. "/api/v1/translation-projects/65/" |
38
|
|
|
|
|
|
|
stores => { type => ARRAYREF } , #eg. [ "/api/v1/stores/77/", ... ] |
39
|
|
|
|
|
|
|
}); |
40
|
0
|
|
|
|
|
|
my $s = bless(\%self, $class); |
41
|
|
|
|
|
|
|
|
42
|
0
|
|
|
|
|
|
return $s; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
0
|
|
|
0
|
1
|
|
sub description($s) { return $s->{description} } |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
46
|
0
|
|
|
0
|
1
|
|
sub language($s) { return $s->{language} } |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
47
|
0
|
|
|
0
|
1
|
|
sub pootle_path($s) { return $s->{pootle_path} } |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
48
|
0
|
|
|
0
|
1
|
|
sub project($s) { return $s->{project} } |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
49
|
0
|
|
|
0
|
1
|
|
sub real_path($s) { return $s->{real_path} } |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
50
|
0
|
|
|
0
|
1
|
|
sub resource_uri($s) { return $s->{resource_uri} } |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
51
|
0
|
|
|
0
|
1
|
|
sub stores($s) { return $s->{stores} } |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head2 Accessors |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=over 4 |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=item B |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=item B |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=item B |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=item B |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=item B |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=item B |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=item B |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=cut |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
1; |