]>
iEval git - gruntmaster-data.git/blob - Data.pm
81f519dce97f83d9346aacafa8318fb5be6fd638
2 package Gruntmaster
::Data
;
4 # Created by DBIx::Class::Schema::Loader
5 # DO NOT MODIFY THE FIRST PART OF THIS FILE
10 use base
'DBIx::Class::Schema';
12 __PACKAGE__
->load_namespaces;
15 # Created by DBIx::Class::Schema::Loader v0.07039 @ 2014-03-05 13:11:39
16 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:dAEmtAexvUaNXLgYz2rNEg
18 our $VERSION = '5999.000_005';
20 use Lingua
::EN
::Inflect qw
/PL_N/;
21 use Sub
::Name qw
/subname/;
24 our ($name, $sub) = @_;
26 *$name = subname
$name => $sub
30 for my $rs (qw
/contest contest_problem job open problem user/) {
31 my $rsname = ucfirst $rs;
32 $rsname =~ s/_([a-z])/\u$1/g;
33 dynsub PL_N
($rs) => sub { $_[0]->resultset($rsname) };
34 dynsub
$rs => sub { $_[0]->resultset($rsname)->find($_[1]) };
46 Gruntmaster::Data - Gruntmaster 6000 Online Judge -- database interface and tools
50 my $db = Gruntmaster::Data->connect('dbi:Pg:');
52 my $problem = $db->problem('my_problem');
53 $problem->update({timeout => 2.5}); # Set time limit to 2.5 seconds
54 $problem->rerun; # And rerun all jobs for this problem
58 my $contest = $db->contests->create({ # Create a new contest
60 name => 'My Awesome Contest',
64 $db->contest_problems->create({ # Add a problem to the contest
65 contest => 'my_contest',
66 problem => 'my_problem',
69 say 'The contest has not started yet' if $contest->is_pending;
73 my @jobs = $db->jobs->search({contest => 'my_contest', owner => 'MGV'})->all;
74 $_->rerun for @jobs; # Rerun all jobs sent by MGV in my_contest
78 Gruntmaster::Data is the interface to the Gruntmaster 6000 database. Read the L<DBIx::Class> documentation for usage information.
80 In addition to the typical DBIx::Class::Schema methods, this module contains several convenience methods:
86 Equivalent to C<< $schema->resultset('Contest') >>
88 =item contest_problems
90 Equivalent to C<< $schema->resultset('ContestProblem') >>
94 Equivalent to C<< $schema->resultset('Job') >>
98 Equivalent to C<< $schema->resultset('Problem') >>
102 Equivalent to C<< $schema->resultset('User') >>
106 Equivalent to C<< $schema->resultset('Contest')->find($id) >>
110 Equivalent to C<< $schema->resultset('Job')->find($id) >>
114 Equivalent to C<< $schema->resultset('Problem')->find($id) >>
118 Equivalent to C<< $schema->resultset('User')->find($id) >>
124 Marius Gavrilescu E<lt>marius@ieval.roE<gt>
126 =head1 COPYRIGHT AND LICENSE
128 Copyright (C) 2014 by Marius Gavrilescu
130 This library is free software; you can redistribute it and/or modify
131 it under the same terms as Perl itself, either Perl version 5.18.1 or,
132 at your option, any later version of Perl 5 you may have available.
This page took 0.057265 seconds and 3 git commands to generate.