[Catalyst] Possible bug here?

J. Shirley jshirley at gmail.com
Sun May 31 23:25:49 GMT 2009


On Sun, May 31, 2009 at 2:34 PM, Kieren Diment <diment at gmail.com> wrote:

>
> 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 4=
04")
>> 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 anact=
ion
> :Path :Args(1) ... but maybe I am missing something really obvious ...
>
> sub index :Path :Args(0) {
>   my ( $self, $c ) =3D @_;
>
>   # Hello World
>   $c->response->body( $c->welcome_message );
> }
>
>
> sub anaction :Path : Args(1) {
>        my ($self, $c, $arg) =3D @_;
>        $c->res->body($arg);
> }
>
> sub default :Path {
>   my ( $self, $c ) =3D @_;
>   $c->response->body( 'Page not found' );
>   $c->response->status(404);
> }
>
>
> sub end : ActionClass('RenderView') {}
>
> 1;
>
>
>
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 =3D> '' );

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

# :Path and :Private have the same behavior
sub default :Private {
    my ( $self, $c ) =3D @_;
    $c->response->body( 'Page not found' );
    $c->response->status(404);
}

1;


Easy for a failing test case, at least ;)

-J
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20090531/0ffcf=
57b/attachment.htm


More information about the Catalyst mailing list