##################################################
+my $db = Gruntmaster::Data->connect('dbi:Pg:');
+
sub cmd_help{
exec perldoc => $0
}
}
sub cmd_show{
- local $_ = shift or goto &cmd_list;
- say "Name: ", contest_name;
- say "Owner: ", contest_owner;
- say "Start: ", strftime '%c', localtime contest_start;
- say "End: ", strftime '%c', localtime contest_end;
+# local $_ = shift or goto &cmd_list;
+# say "Name: ", contest_name;
+# say "Owner: ", contest_owner;
+# say "Start: ", strftime '%c', localtime contest_start;
+# say "End: ", strftime '%c', localtime contest_end;
}
sub cmd_add{
my $name = prompt 'Contest name';
my $owner = prompt 'Owner';
my $start = str2time prompt 'Start time' or die 'Cannot parse time';
- my $end = str2time prompt 'End time' or die 'Cannot parse time';
+ my $stop = str2time prompt 'Stop time' or die 'Cannot parse time';
- insert_contest $id => name => $name, owner => $owner, start => $start, end => $end;
- PUBLISH genpage => "ct/$id/index.html";
- PUBLISH genpage => "ct/index.html";
+ $db->contests->create({id => $id, name => $name, owner => $owner, start => $start, stop => $stop});
+# insert_contest $id => name => $name, owner => $owner, start => $start, stop => $stop;
+# PUBLISH genpage => "ct/$id/index.html";
+# PUBLISH genpage => "ct/index.html";
}
sub cmd_rm{
- remove_contest shift;
- PUBLISH genpage => "ct/index.html";
+# remove_contest shift;
+# PUBLISH genpage => "ct/index.html";
}
##################################################