From: Andy Grundman Date: Sat, 22 Oct 2005 18:02:51 +0000 (+0000) Subject: Fixed the args passed to default X-Git-Tag: 5.7099_04~1123 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=7cfcfd27da587caea68fc6240f1cc4c797e9df6f Fixed the args passed to default --- diff --git a/lib/Catalyst.pm b/lib/Catalyst.pm index 89b7f9f..079dfcb 100644 --- a/lib/Catalyst.pm +++ b/lib/Catalyst.pm @@ -750,14 +750,15 @@ sub execute { } $c->{depth}++; eval { - if ( $c->debug ) - { + if ( $c->debug ) { my ( $elapsed, @state ) = $c->benchmark( $code, $class, $c, @{ $c->req->args } ); push @{ $c->{stats} }, [ $action, sprintf( '%fs', $elapsed ) ]; $c->state(@state); } - else { $c->state( &$code( $class, $c, @{ $c->req->args } ) || 0 ) } + else { + $c->state( &$code( $class, $c, @{ $c->req->args } ) || 0 ) + } }; $c->{depth}--; diff --git a/lib/Catalyst/DispatchType/Default.pm b/lib/Catalyst/DispatchType/Default.pm index ff1f83e..9cd82bf 100644 --- a/lib/Catalyst/DispatchType/Default.pm +++ b/lib/Catalyst/DispatchType/Default.pm @@ -31,6 +31,8 @@ sub match { $c->action( $result->[0] ); $c->namespace( $c->req->path ); $c->req->action('default'); + # default methods receive the controller name as the first argument + unshift @{ $c->req->args }, ( split /\//, $result->[0] )[0]; $c->req->match(''); return 1; }