| 1 | package GrowthForecast::Aggregator::DBMulti; | ||||||||||||
| 2 | 1 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 3 | 1 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 4 | 1 | ▶ | use utf8; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 5 | 1 | ▶ | use Encode qw(encode_utf8); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 6 | 1 | ▶ | use HTTP::Request::Common; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 7 | |||||||||||||
| 8 | 1 | ▶ | use Mouse; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 9 | |||||||||||||
| 10 | 1 | has names => ( | |||||||||||
| 11 | is => 'ro', | ||||||||||||
| 12 | isa => 'ArrayRef[Str]', | ||||||||||||
| 13 | required => 1, | ||||||||||||
| 14 | ); | ||||||||||||
| 15 | |||||||||||||
| 16 | 1 | has descriptions => ( | |||||||||||
| 17 | is => 'ro', | ||||||||||||
| 18 | isa => 'ArrayRef[Str]', | ||||||||||||
| 19 | required => 1, | ||||||||||||
| 20 | ); | ||||||||||||
| 21 | |||||||||||||
| 22 | 1 | has section => ( | |||||||||||
| 23 | is => 'ro', | ||||||||||||
| 24 | isa => 'Str', | ||||||||||||
| 25 | required => 1, | ||||||||||||
| 26 | ); | ||||||||||||
| 27 | |||||||||||||
| 28 | 1 | has query => ( | |||||||||||
| 29 | is => 'rw', | ||||||||||||
| 30 | isa => 'Str', | ||||||||||||
| 31 | required => 1, | ||||||||||||
| 32 | ); | ||||||||||||
| 33 | |||||||||||||
| 34 | has binds => ( | ||||||||||||
| 35 | is => 'rw', | ||||||||||||
| 36 | isa => 'ArrayRef', | ||||||||||||
| 37 | 0 | ▶ | default => sub { +[ ] }, | ||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||
| 38 | 1 | ); | |||||||||||
| 39 | |||||||||||||
| 40 | 1 | ▶ | no Mouse; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 41 | |||||||||||||
| 42 | 0 | ▶ | sub run { | ||||||||||
|
Subroutine
run: not called CC=6 SCAR=37.4
Pod
undocumented
| |||||||||||||
| 43 | 0 | my $self = shift; | |||||||||||
| 44 | 0 | my %args = @_; | |||||||||||
| 45 | 0 | ▶ | my $dbh = $args{dbh} // die "Missing mandatory parameter: dbh"; | ||||||||||
|
Condition0%0/2
$args{"dbh"} // die("Missing mandatory parameter: dbh")
MC/DC0%0/1
$args{"dbh"} // die("Missing mandatory parameter: dbh")
$args{"dbh"}
Truth table0%0/2
A
A= $args{"dbh"}
| |||||||||||||
| 46 | 0 | ▶ | my $service = $args{service} // die "Missing mandatory parameter: service"; | ||||||||||
|
Condition0%0/2
$args{"service"} // die("Missing mandatory parameter: service")
MC/DC0%0/1
$args{"service"} // die("Missing mandatory parameter: service")
$args{"service"}
Truth table0%0/2
A
A= $args{"service"}
| |||||||||||||
| 47 | 0 | ▶ | my $endpoint = $args{endpoint} // die "Missing mandatory parameter: endpoint"; | ||||||||||
|
Condition0%0/2
$args{"endpoint"} // die("Missing mandatory parameter: endpoint")
MC/DC0%0/1
$args{"endpoint"} // die("Missing mandatory parameter: endpoint")
$args{"endpoint"}
Truth table0%0/2
A
A= $args{"endpoint"}
| |||||||||||||
| 48 | 0 | ▶ | my $ua = $args{ua} // die "Missing mandatory parameter: ua"; | ||||||||||
|
Condition0%0/2
$args{"ua"} // die("Missing mandatory parameter: ua")
MC/DC0%0/1
$args{"ua"} // die("Missing mandatory parameter: ua")
$args{"ua"}
Truth table0%0/2
A
A= $args{"ua"}
| |||||||||||||
| 49 | |||||||||||||
| 50 | 0 | $endpoint =~ s!/$!!; | |||||||||||
| 51 | |||||||||||||
| 52 | 0 | my @numbers = $dbh->selectrow_array($self->query, {}, @{$self->binds}); | |||||||||||
| 53 | |||||||||||||
| 54 | 0 | my @res; | |||||||||||
| 55 | 0 | ▶ | for (my $i=0; $i<@{$self->names}; $i++) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 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 | 1; | |||||||||||
| 71 | __END__ | ||||||||||||