[Catalyst] Possible bug here?

Kieren Diment diment at gmail.com
Sun May 31 21:34:42 GMT 2009


On 01/06/2009, at 1:17 AM, Matthias Dietrich wrote:

> Kieren,
>
>> Here's the code:
>>
>> [...]
>>
>> And here's the output from script/testapp_test /foo:
>>
>> Page not found
>>
>> Either this is a bug or there's something very obvious wrong which  
>> I'm missing ...
>
> what would you expect?  As you don't have an action "foo", the  
> "default" action is called (which is a dhandler in Mason-speak or  
> "ErrorDocument 404") which outputs "Page not found".
>
> matt
>

err wouldn't sub anaction :Path : Args(1) be supposed to get anything  
with a single argument there? Comment the default action out and we do  
get the output of "foo", so it looks to me like default :Path is  
overriding anaction :Path :Args(1) ... but maybe I am missing  
something really obvious ...

sub index :Path :Args(0) {
    my ( $self, $c ) = @_;

    # Hello World
    $c->response->body( $c->welcome_message );
}


sub anaction :Path : Args(1) {
	my ($self, $c, $arg) = @_;
	$c->res->body($arg);
}

sub default :Path {
    my ( $self, $c ) = @_;
    $c->response->body( 'Page not found' );
    $c->response->status(404);
}


sub end : ActionClass('RenderView') {}

1;




More information about the Catalyst mailing list