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