Your Name 4632132d02 fixup perlcritic: indirect new
> Subroutine new called using indirect syntax at line 14, column 14.  See page 349 of PBP.  (Severity: 5)
2021-08-20 11:39:19 -04:00

28 lines
595 B
Perl

package Hydra::View::NixNAR;
use strict;
use base qw/Catalyst::View/;
use Hydra::Helper::CatalystUtils;
sub process {
my ($self, $c) = @_;
my $storePath = $c->stash->{storePath};
my $numThreads = $c->config->{'compress_num_threads'};
my $pParam = ($numThreads > 0) ? "-p$numThreads" : "";
$c->response->content_type('application/x-nix-archive'); # !!! check MIME type
my $fh = IO::Handle->new();
open $fh, "nix-store --dump '$storePath' | pixz -0 $pParam |";
setCacheHeaders($c, 365 * 24 * 60 * 60);
$c->response->body($fh);
return 1;
}
1;