[Catalyst] Possible bug here?
Kieren Diment
diment at gmail.com
Mon Jun 1 00:43:23 GMT 2009
On Mon, Jun 1, 2009 at 9:25 AM, J. Shirley <jshirley at gmail.com> wrote:
>
> Weird... I don't think you are missing anything obvious.
>
> You can trim this down and get the same results (just to remove index from
> the mix):
>
> package MyApp::Controller::Root;
> use parent 'Catalyst::Controller';
> __PACKAGE__->config( namespace => '' );
>
> sub anaction : Path Args(1) {
> my ( $self, $c, $arg ) = @_;
> $c->res->output($arg);
> }
>
> # :Path and :Private have the same behavior
> sub default :Private {
> my ( $self, $c ) = @_;
> $c->response->body( 'Page not found' );
> $c->response->status(404);
> }
>
> 1;
>
>
> Easy for a failing test case, at least ;)
Yeah, it appears to be a backwards compat bug. The following does
work. This either needs to be documented or fixed.
package TestApp::Controller::Root;
use strict;
use warnings;
use parent 'Catalyst::Controller';
__PACKAGE__->config->{namespace} = '';
sub handle_404 :Path {
my ( $self, $c ) = @_;
$c->response->body( 'Page not found' );
$c->response->status(404);
}
sub anaction :Path : Args(1) {
my ($self, $c, $arg) = @_;
$c->res->body($arg);
}
sub end : ActionClass('RenderView') {}
1;
More information about the Catalyst
mailing list