Support source_code input
authorMarius Gavrilescu <marius@ieval.ro>
Mon, 27 Jan 2014 09:20:40 +0000 (11:20 +0200)
committerMarius Gavrilescu <marius@ieval.ro>
Mon, 27 Jan 2014 09:20:40 +0000 (11:20 +0200)
lib/Gruntmaster/Handlers.pm

index f0281f2826f939da53e258a279818821d7e934b0..41ccfb45ef5d249539bcda8647ef2f5b21e8f844 100644 (file)
@@ -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);
 
This page took 0.010548 seconds and 4 git commands to generate.