Fixed the args passed to default
Andy Grundman [Sat, 22 Oct 2005 18:02:51 +0000 (18:02 +0000)]
lib/Catalyst.pm
lib/Catalyst/DispatchType/Default.pm

index 89b7f9f..079dfcb 100644 (file)
@@ -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}--;
 
index ff1f83e..9cd82bf 100644 (file)
@@ -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;
     }