]>
Commit | Line | Data |
---|---|---|
4ed3f8e7 | 1 | use utf8; |
bbf8209c | 2 | package Gruntmaster::Data; |
4ed3f8e7 MG |
3 | |
4 | # Created by DBIx::Class::Schema::Loader | |
5 | # DO NOT MODIFY THE FIRST PART OF THIS FILE | |
6 | ||
7 | use strict; | |
bbf8209c | 8 | use warnings; |
014ee8a6 | 9 | |
4ed3f8e7 MG |
10 | use base 'DBIx::Class::Schema'; |
11 | ||
12 | __PACKAGE__->load_namespaces; | |
014ee8a6 | 13 | |
f7386aab | 14 | |
4ed3f8e7 MG |
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/; | |
014ee8a6 MG |
22 | |
23 | sub dynsub{ | |
fb6a4e3d | 24 | our ($name, $sub) = @_; |
014ee8a6 | 25 | no strict 'refs'; |
fb6a4e3d | 26 | *$name = subname $name => $sub |
014ee8a6 MG |
27 | } |
28 | ||
29 | BEGIN { | |
4ed3f8e7 MG |
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]) }; | |
014ee8a6 MG |
35 | } |
36 | } | |
37 | ||
f7386aab | 38 | 1; |
4a8747ef MG |
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 |