]>
Commit | Line | Data |
---|---|---|
923655e1 MG |
1 | package Gruntmaster::Page::Src; |
2 | ||
3 | use 5.014000; | |
4 | use strict; | |
5 | use warnings; | |
6 | use Gruntmaster::Page::Base; | |
7 | our @ISA = qw/Gruntmaster::Page::Base/; | |
8 | our $VERSION = '0.001'; | |
9 | ||
10 | use constant CONTENT_TYPES => +{ | |
11 | c => 'text/x-csrc', | |
12 | cpp => 'text/x-c++src', | |
13 | cs => 'text/x-chsarp', # Used by GNOME. Not in mime.types. | |
14 | java => 'text/x-java', | |
15 | pas => 'text/x-pascal', | |
16 | pl => 'text/x-perl', | |
17 | py => 'text/x-python', | |
18 | }; | |
19 | ||
20 | sub generate{ | |
191f4979 MG |
21 | my ($self, $format, $env, $ct, $job, $ext) = @_; |
22 | debug $env => "Contest is $ct, job is $job and extension is $ext"; | |
923655e1 MG |
23 | local $Gruntmaster::Data::contest = $ct if $ct; |
24 | ||
25 | [200, ['Content-Type' => CONTENT_TYPES->{$ext}, 'Cache-Control' => 'max-age=604800'], [job_inmeta($job)->{files}{prog}{content}] ] | |
26 | } | |
27 | ||
28 | sub variants{ [[file => 1, undef, undef, undef, undef, undef]] } | |
29 | ||
30 | 1 |