Fixed some bugs and improved logs
Sebastian Riedel [Wed, 9 Nov 2005 23:30:44 +0000 (23:30 +0000)]
lib/Catalyst.pm
lib/Catalyst/Component.pm
lib/Catalyst/Dispatcher.pm
t/live/lib/TestApp/Controller/Action.pm

index 781736c..8d59a4d 100644 (file)
@@ -22,7 +22,7 @@ __PACKAGE__->mk_accessors(
     qw/counter depth request response state action namespace/
 );
 
-attributes->import(__PACKAGE__, \&namespace, 'lvalue');
+attributes->import( __PACKAGE__, \&namespace, 'lvalue' );
 
 # Laziness++
 *comp = \&component;
@@ -415,8 +415,11 @@ sub setup {
     $class->setup_components;
 
     if ( $class->debug ) {
-        my $t = Text::SimpleTable->new(76);
-        $t->row($_) for sort keys %{ $class->components };
+        my $t = Text::SimpleTable->new( [ 37, 'Class' ], [ 36, 'Type' ] );
+        for my $comp ( sort keys %{ $class->components } ) {
+            my $type = ref $class->components->{$comp} ? 'instance' : 'class';
+            $t->row( $comp, $type );
+        }
         $class->log->debug( "Loaded components:\n" . $t->draw )
           if ( keys %{ $class->components } );
     }
@@ -991,7 +994,7 @@ Get an action in a given namespace.
 
 =cut
 
-sub get_action { my $c = shift; $c->dispatcher->get_action( @_ ) }
+sub get_action { my $c = shift; $c->dispatcher->get_action(@_) }
 
 =item $c->get_actions( $action, $namespace )
 
index 097af41..5718b28 100644 (file)
@@ -1,7 +1,7 @@
 package Catalyst::Component;
 
 use strict;
-use base qw/Class::Data::Inheritable/;
+use base qw/Class::Accessor::Fast Class::Data::Inheritable/;
 use NEXT;
 
 __PACKAGE__->mk_classdata($_) for qw/_config/;
index e9ae03e..5fc33c0 100644 (file)
@@ -206,7 +206,7 @@ sub get_action {
 
     return unless @match;
 
-    if ( my $action = $match[-1]->get_action( $name ) ) {
+    if ( my $action = $match[-1]->get_action($name) ) {
         return $action if $action->namespace eq $namespace;
     }
 }
@@ -223,7 +223,7 @@ sub get_actions {
 
     my @match = $self->get_containers($namespace);
 
-    return map { $_->get_action( $action ) } @match;
+    return map { $_->get_action($action) } @match;
 }
 
 =item $self->get_containers( $namespace )
@@ -361,7 +361,11 @@ sub setup_actions {
 
     return unless $c->debug;
 
-    my $privates = Text::SimpleTable->new( [ 36, 'Private' ], [ 37, 'Class' ] );
+    my $privates = Text::SimpleTable->new(
+        [ 24, 'Private' ],
+        [ 23, 'Class' ],
+        [ 23, 'Method' ]
+    );
 
     my $has_private = 0;
     my $walker = sub {
@@ -375,7 +379,7 @@ sub setup_actions {
             next
               if ( ( $action =~ /^_.*/ )
                 && ( !$c->config->{show_internal_actions} ) );
-            $privates->row( "$prefix$action", $action_obj->class );
+            $privates->row( "$prefix$action", $action_obj->class, $action );
             $has_private = 1;
         }
 
index acd8385..02bd50a 100644 (file)
@@ -1,7 +1,7 @@
 package TestApp::Controller::Action;
 
 use strict;
-use base 'Catalyst::Base';
+use base 'Catalyst::Controller';
 
 sub begin : Private {
     my ( $self, $c ) = @_;