| 1 | package GrowthForecast::Aggregator::DB; | ||||||||||||
| 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 name => ( | |||||||||||
| 11 | is => 'ro', | ||||||||||||
| 12 | isa => 'Str', | ||||||||||||
| 13 | required => 1, | ||||||||||||
| 14 | ); | ||||||||||||
| 15 | |||||||||||||
| 16 | 1 | has description => ( | |||||||||||
| 17 | is => 'ro', | ||||||||||||
| 18 | isa => '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=5 SCAR=34.0
Pod
undocumented
| |||||||||||||
| 43 | 0 | my $self = shift; | |||||||||||
| 44 | 0 | my %args = @_; | |||||||||||
| 45 | |||||||||||||
| 46 | 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"}
| |||||||||||||
| 47 | 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"}
| |||||||||||||
| 48 | 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"}
| |||||||||||||
| 49 | 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"}
| |||||||||||||
| 50 | |||||||||||||
| 51 | 0 | $endpoint =~ s!/$!!; | |||||||||||
| 52 | |||||||||||||
| 53 | 0 | my $url = "$endpoint/$service/$self->{section}/$self->{name}"; | |||||||||||
| 54 | |||||||||||||
| 55 | 0 | my $sth = $dbh->prepare($self->query); | |||||||||||
| 56 | 0 | $sth->execute(@{$self->binds}); | |||||||||||
| 57 | 0 | my ($number) = $sth->fetchrow_array(); | |||||||||||
| 58 | 0 | my $req = POST $url, [ | |||||||||||
| 59 | number => $number, | ||||||||||||
| 60 | description => encode_utf8($self->description), | ||||||||||||
| 61 | ]; | ||||||||||||
| 62 | 0 | my $res = $ua->request($req); | |||||||||||
| 63 | 0 | return $res; | |||||||||||
| 64 | } | ||||||||||||
| 65 | |||||||||||||
| 66 | 1 | 1; | |||||||||||
| 67 | __END__ | ||||||||||||