line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package GrowthForecast::Aggregator::DBMulti; |
2
|
1
|
|
|
1
|
|
13
|
use strict; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
76
|
|
3
|
1
|
|
|
1
|
|
10
|
use warnings; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
52
|
|
4
|
1
|
|
|
1
|
|
8
|
use utf8; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
12
|
|
5
|
1
|
|
|
1
|
|
45
|
use Encode qw(encode_utf8); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
97
|
|
6
|
1
|
|
|
1
|
|
10
|
use HTTP::Request::Common; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
112
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
8
|
use Mouse; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
13
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
has names => ( |
11
|
|
|
|
|
|
|
is => 'ro', |
12
|
|
|
|
|
|
|
isa => 'ArrayRef[Str]', |
13
|
|
|
|
|
|
|
required => 1, |
14
|
|
|
|
|
|
|
); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
has descriptions => ( |
17
|
|
|
|
|
|
|
is => 'ro', |
18
|
|
|
|
|
|
|
isa => 'ArrayRef[Str]', |
19
|
|
|
|
|
|
|
required => 1, |
20
|
|
|
|
|
|
|
); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
has section => ( |
23
|
|
|
|
|
|
|
is => 'ro', |
24
|
|
|
|
|
|
|
isa => 'Str', |
25
|
|
|
|
|
|
|
required => 1, |
26
|
|
|
|
|
|
|
); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
has query => ( |
29
|
|
|
|
|
|
|
is => 'rw', |
30
|
|
|
|
|
|
|
isa => 'Str', |
31
|
|
|
|
|
|
|
required => 1, |
32
|
|
|
|
|
|
|
); |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
has binds => ( |
35
|
|
|
|
|
|
|
is => 'rw', |
36
|
|
|
|
|
|
|
isa => 'ArrayRef', |
37
|
|
|
|
|
|
|
default => sub { +[ ] }, |
38
|
|
|
|
|
|
|
); |
39
|
|
|
|
|
|
|
|
40
|
1
|
|
|
1
|
|
1124
|
no Mouse; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
7
|
|
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub run { |
43
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
44
|
0
|
|
|
|
|
|
my %args = @_; |
45
|
0
|
|
0
|
|
|
|
my $dbh = $args{dbh} // die "Missing mandatory parameter: dbh"; |
46
|
0
|
|
0
|
|
|
|
my $service = $args{service} // die "Missing mandatory parameter: service"; |
47
|
0
|
|
0
|
|
|
|
my $endpoint = $args{endpoint} // die "Missing mandatory parameter: endpoint"; |
48
|
0
|
|
0
|
|
|
|
my $ua = $args{ua} // die "Missing mandatory parameter: ua"; |
49
|
|
|
|
|
|
|
|
50
|
0
|
|
|
|
|
|
$endpoint =~ s!/$!!; |
51
|
|
|
|
|
|
|
|
52
|
0
|
|
|
|
|
|
my @numbers = $dbh->selectrow_array($self->query, {}, @{$self->binds}); |
|
0
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
|
54
|
0
|
|
|
|
|
|
my @res; |
55
|
0
|
|
|
|
|
|
for (my $i=0; $i<@{$self->names}; $i++) { |
|
0
|
|
|
|
|
|
|
56
|
0
|
|
|
|
|
|
my $name = $self->names->[$i]; |
57
|
|
|
|
|
|
|
|
58
|
0
|
|
|
|
|
|
my $url = "$endpoint/$service/$self->{section}/$name"; |
59
|
|
|
|
|
|
|
|
60
|
0
|
|
|
|
|
|
my $req = POST $url, [ |
61
|
|
|
|
|
|
|
number => $numbers[$i], |
62
|
|
|
|
|
|
|
description => encode_utf8($self->descriptions->[$i]), |
63
|
|
|
|
|
|
|
]; |
64
|
0
|
|
|
|
|
|
my $res = $ua->request($req); |
65
|
0
|
|
|
|
|
|
push @res, $res; |
66
|
|
|
|
|
|
|
} |
67
|
0
|
|
|
|
|
|
return @res; |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
1; |
71
|
|
|
|
|
|
|
__END__ |