From: Sebastian Riedel Date: Wed, 9 Nov 2005 23:30:44 +0000 (+0000) Subject: Fixed some bugs and improved logs X-Git-Tag: 5.7099_04~985 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=684d10edf63074f94667d437db01d30b8d13cefc;hp=261c571ec577304a8a41218a4576675c8099069a Fixed some bugs and improved logs --- diff --git a/lib/Catalyst.pm b/lib/Catalyst.pm index 781736c..8d59a4d 100644 --- a/lib/Catalyst.pm +++ b/lib/Catalyst.pm @@ -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 ) diff --git a/lib/Catalyst/Component.pm b/lib/Catalyst/Component.pm index 097af41..5718b28 100644 --- a/lib/Catalyst/Component.pm +++ b/lib/Catalyst/Component.pm @@ -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/; diff --git a/lib/Catalyst/Dispatcher.pm b/lib/Catalyst/Dispatcher.pm index e9ae03e..5fc33c0 100644 --- a/lib/Catalyst/Dispatcher.pm +++ b/lib/Catalyst/Dispatcher.pm @@ -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; } diff --git a/t/live/lib/TestApp/Controller/Action.pm b/t/live/lib/TestApp/Controller/Action.pm index acd8385..02bd50a 100644 --- a/t/live/lib/TestApp/Controller/Action.pm +++ b/t/live/lib/TestApp/Controller/Action.pm @@ -1,7 +1,7 @@ package TestApp::Controller::Action; use strict; -use base 'Catalyst::Base'; +use base 'Catalyst::Controller'; sub begin : Private { my ( $self, $c ) = @_;