8e51d8ba71b676455badcb638a57a5ee1d7f6407
[gruntmaster-page.git] / lib / Gruntmaster / Page / Src.pm
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{
21 my ($self, $format, $env, $ct, $job, $ext) = @_;
22 debug $env => "Contest is $ct, job is $job and extension is $ext";
23 local $Gruntmaster::Data::contest = $ct if $ct;
24
25 [200, ['Content-Type' => CONTENT_TYPES->{$ext}, 'Cache-Control' => 'max-age=604800', 'X-Forever' => 1], [job_inmeta($job)->{files}{prog}{content}] ]
26 }
27
28 sub variants{ [[file => 1, undef, undef, undef, undef, undef]] }
29
30 1
This page took 0.02261 seconds and 3 git commands to generate.