]>
Commit | Line | Data |
---|---|---|
1 | package Gruntmaster::Page::Src; | |
2 | ||
3 | use Gruntmaster::Page::Base; | |
4 | ||
5 | use constant CONTENT_TYPES => +{ | |
6 | c => 'text/x-csrc', | |
7 | cpp => 'text/x-c++src', | |
8 | cs => 'text/x-chsarp', # Used by GNOME. Not in mime.types. | |
9 | java => 'text/x-java', | |
10 | pas => 'text/x-pascal', | |
11 | pl => 'text/x-perl', | |
12 | py => 'text/x-python', | |
13 | }; | |
14 | ||
15 | sub generate{ | |
16 | my ($self, $format, $env, $job, $ext) = @_; | |
17 | debug $env => "Job is $job and extension is $ext"; | |
18 | ||
19 | [200, ['Content-Type' => CONTENT_TYPES->{$ext}, 'Cache-Control' => 'max-age=604800', 'X-Forever' => 1], [db($env)->job($job)->source] ] | |
20 | } | |
21 | ||
22 | 1 |