
jshirley at gmail
May 31, 2009, 4:25 PM
Post #4 of 7
(549 views)
Permalink
|
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
|