| 1 | package # hide from PAUSE | ||||||||||||||||||||
| 2 | Hopkins::Plugin::HMI::Catalyst::Controller::Task; | ||||||||||||||||||||
| 3 | 1 | ▶ | BEGIN { | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 4 | 1 | $Hopkins::Plugin::HMI::Catalyst::Controller::Task::VERSION = '0.900'; | |||||||||||||||||||
| 5 | } | ||||||||||||||||||||
| 6 | |||||||||||||||||||||
| 7 | 1 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 8 | 1 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 9 | |||||||||||||||||||||
| 10 | =head1 NAME | ||||||||||||||||||||
| 11 | |||||||||||||||||||||
| 12 | Hopkins::Plugin::HMI::Catalyst::Controller::Task | ||||||||||||||||||||
| 13 | |||||||||||||||||||||
| 14 | =head1 DESCRIPTION | ||||||||||||||||||||
| 15 | |||||||||||||||||||||
| 16 | =cut | ||||||||||||||||||||
| 17 | |||||||||||||||||||||
| 18 | 1 | ▶ | use base 'Hopkins::Plugin::HMI::Catalyst::Controller'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 19 | |||||||||||||||||||||
| 20 | 1 | ▶ | use LWP::UserAgent; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 21 | |||||||||||||||||||||
| 22 | =head1 METHODS | ||||||||||||||||||||
| 23 | |||||||||||||||||||||
| 24 | =cut | ||||||||||||||||||||
| 25 | |||||||||||||||||||||
| 26 | =over 4 | ||||||||||||||||||||
| 27 | |||||||||||||||||||||
| 28 | =item enqueue | ||||||||||||||||||||
| 29 | |||||||||||||||||||||
| 30 | =cut | ||||||||||||||||||||
| 31 | |||||||||||||||||||||
| 32 | 0 | ▶ | sub enqueue : Local | ||||||||||||||||||
|
Subroutine
enqueue: not called CC=3 SCAR=24.8
| |||||||||||||||||||||
| 33 | { | ||||||||||||||||||||
| 34 | 0 | my $self = shift; | |||||||||||||||||||
| 35 | 0 | my $c = shift; | |||||||||||||||||||
| 36 | |||||||||||||||||||||
| 37 | 0 | my $hopkins = $c->config->{hopkins}; | |||||||||||||||||||
| 38 | 0 | my @tasks = $hopkins->config->get_task_names; | |||||||||||||||||||
| 39 | 0 | ▶ | my $name = $c->req->params->{name} || $tasks[0]; | ||||||||||||||||||
|
Condition0%0/3
$c->req->params->{'name'} || $tasks[0]
MC/DC0%0/2
$c->req->params->{'name'} || $tasks[0]
$c->req->params->{'name'}
$tasks[0]
Truth table0%0/3
A || B
A= $c->req->params->{'name'}B= $tasks[0]
| |||||||||||||||||||||
| 40 | 0 | my $task = $hopkins->config->get_task_info($name); | |||||||||||||||||||
| 41 | |||||||||||||||||||||
| 42 | 0 | ▶ | if ($c->req->method eq 'POST') { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 43 | 0 | my @keys = map { /^option_(.*)/ } keys %{ $c->req->params }; | |||||||||||||||||||
| 44 | 0 | my $opts = { map { $_ => $c->req->params->{"option_$_"} } @keys }; | |||||||||||||||||||
| 45 | 0 | my $task = $c->req->params->{task}; | |||||||||||||||||||
| 46 | 0 | my $args = { }; | |||||||||||||||||||
| 47 | |||||||||||||||||||||
| 48 | 0 | $args->{priority} = $c->req->params->{priority}; | |||||||||||||||||||
| 49 | 0 | $args->{when} = $c->req->params->{date_to_execute}; | |||||||||||||||||||
| 50 | |||||||||||||||||||||
| 51 | 0 | $hopkins->kernel->post(manager => enqueue => $task => $opts => $args); | |||||||||||||||||||
| 52 | |||||||||||||||||||||
| 53 | 0 | $c->res->redirect($c->uri_for('/status')); | |||||||||||||||||||
| 54 | } | ||||||||||||||||||||
| 55 | |||||||||||||||||||||
| 56 | 0 | $c->stash->{task} = $task; | |||||||||||||||||||
| 57 | 0 | $c->stash->{tasks} = [ sort @tasks ]; | |||||||||||||||||||
| 58 | 1 | ▶ | } | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 59 | |||||||||||||||||||||
| 60 | =back | ||||||||||||||||||||
| 61 | |||||||||||||||||||||
| 62 | =head1 AUTHOR | ||||||||||||||||||||
| 63 | |||||||||||||||||||||
| 64 | Mike Eldridge <diz@cpan.org> | ||||||||||||||||||||
| 65 | |||||||||||||||||||||
| 66 | =head1 LICENSE | ||||||||||||||||||||
| 67 | |||||||||||||||||||||
| 68 | This program is free software; you may redistribute it | ||||||||||||||||||||
| 69 | and/or modify it under the same terms as Perl itself. | ||||||||||||||||||||
| 70 | |||||||||||||||||||||
| 71 | =cut | ||||||||||||||||||||
| 72 | |||||||||||||||||||||
| 73 | 1 | 1; | |||||||||||||||||||