fixup for dupe actions
Matt S Trout [Thu, 22 Jun 2006 13:25:41 +0000 (13:25 +0000)]
lib/Catalyst/Base.pm
lib/Catalyst/DispatchType/Path.pm

index 1fe7d94..65f3120 100644 (file)
@@ -162,7 +162,7 @@ sub register_actions {
 
     foreach my $cache (@action_cache) {
         my $code   = $cache->[0];
-        my $method = $methods{$code};
+        my $method = delete $methods{$code}; # avoid dupe registers
         next unless $method;
         my $attrs = $self->_parse_attrs( $c, $method, @{ $cache->[1] } );
         if ( $attrs->{Private} && ( keys %$attrs > 1 ) ) {
index 0cd698c..52fdb73 100644 (file)
@@ -27,9 +27,9 @@ sub list {
     my ( $self, $c ) = @_;
     my $paths = Text::SimpleTable->new( [ 35, 'Path' ], [ 36, 'Private' ] );
     foreach my $path ( sort keys %{ $self->{paths} } ) {
+        my $display_path = $path eq '/' ? $path : "/$path";
         foreach my $action ( @{ $self->{paths}->{$path} } ) {
-            $path = "/$path" unless $path eq '/';
-            $paths->row( "$path", "/$action" );
+            $paths->row( $display_path, "/$action" );
         }
     }
     $c->log->debug( "Loaded Path actions:\n" . $paths->draw )