MrGamoo/API/JobCreate.pm untested

filter: Statementstmt 0.0% 0 / 28 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 41 CC 4 SCAR 23.0
CC
4
Cov
0%
handler
20.0
BEGIN
2.0
BEGIN
2.0
CRAP 10.0
1 # -*- perl -*-
2  
3 # Copyright (c) 2010 AdCopy
4 # Author: Jeff Weisberg
5 # Created: 2010-Jan-13 12:11 (EST)
6 # Function:
7 #
8 # $Id: JobCreate.pm,v 1.1 2010/11/01 18:41:52 jaw Exp $
9  
10 package AC::MrGamoo::API::JobCreate;
11 use AC::MrGamoo::Debug 'api_job';
12 use AC::MrGamoo::Config;
13 use AC::MrGamoo::Protocol;
14  
15 use AC::MrGamoo::API::Simple;
16  
17 use strict;
18  
19 sub handler {
20 my $class = shift;
21 my $io = shift;
22 my $proto = shift;
23 my $req = shift;
24 my $content = shift;
25  
26 debug("new job $req->{jobid}");
27  
28 if( $req->{console} =~ /^:/ ){
29 # fill in ip addr
30 $req->{console} = $io->{from_ip} . $req->{console};
31 }
32  
33 my $x = AC::MrGamoo::Job->new( %$req );
34 my $r = $x ? $x->start() : undef;
35  
36 if( $r ){
37 reply( 200, 'OK', $io, $proto, $req );
38 }else{
39 reply( 500, 'Error', $io, $proto, $req );
40 }
41 }
42  
43 1;