7 defined $ENV{"MO_ROOT"} or die "Please set MO_ROOT to the contest root directory first.\n";
9 use lib $ENV{"MO_ROOT"} . "/submit";
10 use lib $ENV{"MO_ROOT"} . "/lib/perl5";
16 @ARGV == 2 || @ARGV == 3 or die "Usage: remote-submit <task> [<part>] <filename>\n";
24 my ($ext) = ($file =~ /\.([^.]+)$/) or die "Unable to determine filename extension\n";
26 open F, $file or die "Unable to open $file: $!\n";
27 my $s = stat(*F) or die;
30 my $conn = new MO::Submit;
32 my $he = $conn->write_history($task, $part, $ext, $file);
33 if (defined $he) { die "$he\n"; }
35 $conn->connect or die $conn->{"error"} . "\n";
39 if (!defined $r) { die $conn->{"error"} . "\n"; }
40 my $err = $r->get("-");
41 if ($err) { die "$err\n"; }
44 my $r = new Sherlock::Object("!" => "SUBMIT", "T" => $task, "P" => $part, "X" => $ext, "S" => $size);
45 $r = $conn->request($r);
48 $r = $conn->send_file(\*F, $size);
51 print "Submitted OK.\n";