From: Marius Gavrilescu Date: Mon, 27 Jan 2014 09:20:40 +0000 (+0200) Subject: Support source_code input X-Git-Url: http://git.ieval.ro/?a=commitdiff_plain;h=69ae93bf8c2c07eefbd4692d7b7b420e49eb7b12;p=gruntmaster-handlers.git Support source_code input --- diff --git a/lib/Gruntmaster/Handlers.pm b/lib/Gruntmaster/Handlers.pm index f0281f2..41ccfb4 100644 --- a/lib/Gruntmaster/Handlers.pm +++ b/lib/Gruntmaster/Handlers.pm @@ -43,9 +43,13 @@ sub aputs{ sub submit{ my $r = shift; my $req = Apache2::Request->new($r); - my ($problem, $format, $contest, $private) = map {scalar $req->param($_)} 'problem', 'prog_format', 'contest', 'private'; - my $prog; - $req->upload('prog')->slurp($prog); + my ($problem, $format, $contest, $private, $prog) = map {scalar $req->param($_)} 'problem', 'prog_format', 'contest', 'private', 'source_code'; + my $upload = $req->upload('prog'); + if (defined $upload) { + my $temp; + $upload->slurp($temp); + $prog = $temp if $temp + } die if defined $contest && $contest !~ /^\w+$/ ; die if defined $contest && (time < contest_start $contest || time > contest_end $contest);