Will Hawes wrote:
> On 10/10/2007, *Will Hawes* <[EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>> wrote:
> 
>     With Catalyst::Plugin::Static::Simple loaded, when I request a path
>     like '/static/non-existent-file', the plugin does stuff like
>     $c->res->status(404) for me by default. However, as I already have
>     the following in MyApp::Controller::Root:
> 
>     sub default : Private {
>       my( $self, $c ) = @_;
>       $c->res->status( 404 );
>       $c->res->body( ...  );
>     }
> 
>     I'd like to use my existing default action to display something a
>     bit more user friendly when the requested static file is missing. In
>     this case I'm using the test server so bypassing
>     Catalyst::Plugin::Static::Simple completely is not an option.
> 
>     What's the correct way to implement the above?
> 
> 
> It seems as though the answer is to comment out the following in
> Catalyst::Plugin::Static::Simple (version 0.20):
> 
> $c->_debug_msg( "404: file not found: $path" )
>   if $config->{debug};
> $c->res->status( 404 );
> $c->res->content_type( 'text/html' );
> 
> Setting a HTTP status code other than 200 causes
> Catalyst::Plugin::Static::Simple::dispatch to bail out immediately, so
> Catalyst::Dispatcher::dispatch never gets called for a missing static
> file. Any default action in the app's root controller is ignored as a
> result.
> 
> Would a patch to remove the above lines (or at least make the behaviour
> configurable) be welcome?
> 

Sure. Please include tests.

Oh, and insert usual caveat that static::simple isn't really designed
for production use, but I realise it has its place.

-ash

_______________________________________________
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/
Dev site: http://dev.catalyst.perl.org/

Reply via email to