Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Catalyst: Users

Possible bug here?

 

 

Catalyst users RSS feed   Index | Next | Previous | View Threaded


kdiment at uow

May 31, 2009, 5:08 AM

Post #1 of 7 (558 views)
Permalink
Possible bug here?

Here's the code:

package TestApp::Controller::Root;

use strict;
use warnings;
use parent 'Catalyst::Controller';

__PACKAGE__->config->{namespace} = '';

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;

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 ...

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


mdietrich at cpan

May 31, 2009, 8:17 AM

Post #2 of 7 (519 views)
Permalink
Re: Possible bug here? [In reply to]

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

--
rainboxx Matthias Dietrich
Freier Software Engineer

rainboxx | Tel.: +49 (0) 151 / 50 60 78 64
Tölzer Str. 19 | Mail: matt[at]rainboxx.de
70372 Stuttgart | WWW : http://www.rainboxx.de

XING: https://www.xing.com/profile/Matthias_Dietrich18
GULP: http://www.gulp.de/profil/rainboxx.html
Attachments: PGP.sig (0.19 KB)


diment at gmail

May 31, 2009, 2:34 PM

Post #3 of 7 (516 views)
Permalink
Re: Possible bug here? [In reply to]

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;


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


jshirley at gmail

May 31, 2009, 4:25 PM

Post #4 of 7 (518 views)
Permalink
Re: Possible bug here? [In reply to]

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 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;
>
>
>
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 ;)

-J


diment at gmail

May 31, 2009, 5:43 PM

Post #5 of 7 (516 views)
Permalink
Re: Possible bug here? [In reply to]

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;

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


anexiole at gmail

Jun 1, 2009, 3:39 AM

Post #6 of 7 (508 views)
Permalink
Re: Possible bug here? [In reply to]

http://linux.wareseeker.com/Programming/template-plugin-page-0.10.zip/328911


bobtfish at bobtfish

Jun 1, 2009, 5:00 AM

Post #7 of 7 (501 views)
Permalink
Re: Possible bug here? [In reply to]

Kieren Diment wrote:
> On Mon, Jun 1, 2009 at 9:25 AM, J. Shirley <jshirley[at]gmail.com> wrote:

>> 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.

Not a back compat bug, it's been there forever (at least, it's there in
5.7).

Failing test:

http://dev.catalystframework.org/svnweb/Catalyst/revision?rev=10406

This will get fixed in 5.80005

Cheers
t0m

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

Catalyst users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.