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);