X-Git-Url: http://git.ieval.ro/?a=blobdiff_plain;f=lib%2FGruntmaster%2FPage%2FSrc.pm;fp=lib%2FGruntmaster%2FPage%2FSrc.pm;h=77a5cd20cf4511a5e6c8dcf2f95a86d4a1f8081b;hb=923655e1a9f847c21d3fdb254f58e705f4dd4da9;hp=0000000000000000000000000000000000000000;hpb=eef56f7a0a705023eae000009947e42014dfaefe;p=plack-app-gruntmaster.git diff --git a/lib/Gruntmaster/Page/Src.pm b/lib/Gruntmaster/Page/Src.pm new file mode 100644 index 0000000..77a5cd2 --- /dev/null +++ b/lib/Gruntmaster/Page/Src.pm @@ -0,0 +1,30 @@ +package Gruntmaster::Page::Src; + +use 5.014000; +use strict; +use warnings; +use Gruntmaster::Page::Base; +our @ISA = qw/Gruntmaster::Page::Base/; +our $VERSION = '0.001'; + +use constant CONTENT_TYPES => +{ + c => 'text/x-csrc', + cpp => 'text/x-c++src', + cs => 'text/x-chsarp', # Used by GNOME. Not in mime.types. + java => 'text/x-java', + pas => 'text/x-pascal', + pl => 'text/x-perl', + py => 'text/x-python', +}; + +sub generate{ + my ($self, $format, $logger, $ct, $job, $ext) = @_; + debug $logger => "Contest is $ct, job is $job and extension is $ext"; + local $Gruntmaster::Data::contest = $ct if $ct; + + [200, ['Content-Type' => CONTENT_TYPES->{$ext}, 'Cache-Control' => 'max-age=604800'], [job_inmeta($job)->{files}{prog}{content}] ] +} + +sub variants{ [[file => 1, undef, undef, undef, undef, undef]] } + +1