[Catalyst] Large static files behind Authorisation

Tomas Doran bobtfish at bobtfish.net
Sun Jan 4 10:48:54 GMT 2009


On 4 Jan 2009, at 08:48, Trevor Phillips wrote:
> I'm currently trying to use Catalyst::Plugin::Static::Simple, which  
> has a documented function serve_static_file to serve a static file  
> from a Controller. However, I am getting an error as the TT View is  
> still trying to apply a default template.

Just use a stash key to indicate that you have served a file yourself  
to stop calling TT.. e.g.

sub serve_stuff : Local {
     my ( $self, $c ) = @_;
     $c->serve_static_file('some_file');
     $c->stash->{file_output} = 1;
}

sub end : Private {
     my ( $self, $c ) = @_;
     $c->detach('render') unless $c->stash->{file_output};
}

sub render : ActionClass('RenderView') {}

Cheers
t0m




More information about the Catalyst mailing list