7 defined $ENV{"MO_ROOT"} or die "Please set MO_ROOT to the contest root directory first.\n";
9 use lib $ENV{"MO_ROOT"} . "/lib/perl5";
10 use lib "."; ### FIXME
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;
31 $conn->connect or die $conn->{"error"} . "\n";
35 if (!defined $r) { die $conn->{"error"} . "\n"; }
36 my $err = $r->get("-");
37 if ($err) { die "$err\n"; }
40 my $r = new Sherlock::Object("!" => "SUBMIT", "T" => $task, "P" => $part, "X" => $ext, "S" => $size);
41 $r = $conn->request($r);
44 $r = $conn->send_file(\*F, $size);
47 print "Submitted OK.\n";