fixed that weird bug
Sebastian Riedel [Wed, 16 Mar 2005 13:21:14 +0000 (13:21 +0000)]
Changes
lib/Catalyst.pm
lib/Catalyst/Engine.pm

diff --git a/Changes b/Changes
index 6079fda..21e33f9 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,5 +1,10 @@
 This file documents the revision history for Perl extension Catalyst.
 
+4.26  Wed Mar 16 10:00:00 2005
+        - fixed the weird bug that caused regex actions to fail on every
+          second request
+        - somemore debug messages
+
 4.25  Sat Mar 12 18:00:00 2005
         - correct perl pathes for helper generated scripts (Tatsuhiko Miyagawa)
         - improved cgi engine docs (Christoper Hicks)
index e9c8092..a857494 100644 (file)
@@ -7,7 +7,7 @@ use Catalyst::Log;
 
 __PACKAGE__->mk_classdata($_) for qw/_config log/;
 
-our $VERSION = '4.25';
+our $VERSION = '4.26';
 our @ISA;
 
 =head1 NAME
index 4d25d70..ff01603 100644 (file)
@@ -94,9 +94,8 @@ sub action {
         if    ( my $p = $self->actions->{plain}->{$action} ) { return [$p] }
         elsif ( my $r = $self->actions->{regex}->{$action} ) { return [$r] }
         else {
-            while ( my ( $regex, $name ) =
-                each %{ $self->actions->{compiled} } )
-            {
+            for my $regex ( keys %{ $self->actions->{compiled} } ) {
+                my $name = $self->actions->{compiled}->{$regex};
                 if ( $action =~ $regex ) {
                     my @snippets;
                     for my $i ( 1 .. 9 ) {
@@ -475,10 +474,11 @@ sub prepare {
     }
     $c->prepare_request($r);
     $c->prepare_path;
-    my $path = $c->request->path;
-    $c->log->debug(qq/Requested path "$path"/) if $c->debug;
     $c->prepare_cookies;
     $c->prepare_headers;
+    my $method = $c->req->method;
+    my $path   = $c->req->path;
+    $c->log->debug(qq/"$method" request for "$path"/) if $c->debug;
     $c->prepare_action;
     $c->prepare_parameters;
     $c->prepare_uploads;
@@ -517,8 +517,6 @@ sub prepare_action {
                 $c->log->debug(qq/Requested action "$path"/) if $c->debug;
             }
             $c->req->match($path);
-            $c->log->debug( 'Arguments are "' . join( '/', @args ) . '"' )
-              if ( $c->debug && @args );
             last;
         }
         unshift @args, pop @path;
@@ -536,6 +534,8 @@ sub prepare_action {
             $c->log->debug('Using default action') if $c->debug;
         }
     }
+    $c->log->debug( 'Arguments are "' . join( '/', @args ) . '"' )
+      if ( $c->debug && @args );
 }
 
 =head3 prepare_cookies;