]>
Commit | Line | Data |
---|---|---|
1 | use utf8; | |
2 | package Gruntmaster::Data; | |
3 | ||
4 | # Created by DBIx::Class::Schema::Loader | |
5 | # DO NOT MODIFY THE FIRST PART OF THIS FILE | |
6 | ||
7 | use strict; | |
8 | use warnings; | |
9 | ||
10 | use base 'DBIx::Class::Schema'; | |
11 | ||
12 | __PACKAGE__->load_namespaces; | |
13 | ||
14 | ||
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 | |
17 | ||
18 | our $VERSION = 5999.000_003; | |
19 | ||
20 | use Lingua::EN::Inflect qw/PL_N/; | |
21 | use Sub::Name qw/subname/; | |
22 | ||
23 | sub dynsub{ | |
24 | our ($name, $sub) = @_; | |
25 | no strict 'refs'; | |
26 | *$name = subname $name => $sub | |
27 | } | |
28 | ||
29 | BEGIN { | |
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]) }; | |
35 | } | |
36 | } | |
37 | ||
38 | 1; | |
39 | ||
40 | __END__ | |
41 | ||
42 | =encoding utf-8 | |
43 | ||
44 | =head1 NAME | |
45 | ||
46 | Gruntmaster::Data - Gruntmaster 6000 Online Judge -- database interface and tools | |
47 | ||
48 | =head1 SYNOPSIS | |
49 | ||
50 | my $db = Gruntmaster::Data->connect('dbi:Pg:'); | |
51 | # Typical DBIC stuff here | |
52 | ||
53 | =head1 DESCRIPTION | |
54 | ||
55 | No documentation (yet) | |
56 | ||
57 | =head1 AUTHOR | |
58 | ||
59 | Marius Gavrilescu E<lt>marius@ieval.roE<gt> | |
60 | ||
61 | =head1 COPYRIGHT AND LICENSE | |
62 | ||
63 | Copyright (C) 2014 by Marius Gavrilescu | |
64 | ||
65 | This library is free software: you can redistribute it and/or modify | |
66 | it under the terms of the GNU Affero General Public License as published by | |
67 | the Free Software Foundation, either version 3 of the License, or | |
68 | (at your option) any later version. | |
69 | ||
70 | ||
71 | =cut |