sub _lookup_mvc {
my ( $c, $type, $name, @args ) = @_;
- if (ref $c && !$name && $type ne 'controller') {
- my $current_instance = $c->stash->{current_${type}_instance};
+ if (ref $c && !$name) {
+ my $current_instance = $c->stash->{"current_${type}_instance"};
return $current_instance
- if $current_instance;
+ if $current_instance && $type ne 'controller';
- $name = $c->stash->{current_${type}};
+ $name = $type eq 'controller'
+ ? Catalyst::Utils::class2classshortsuffix($c->action->class)
+ : $c->stash->{"current_${type}"}
+ ;
}
- $name ||= Catalyst::Utils::class2classshortsuffix($c->action->class);
-
return $c->container->get_component_from_sub_container($type, $name, $c, @args);
}
if (
$class->debug and
- my @comps_names_types = $class->container->get_components_names_types
+ my %comps = $class->container->get_all_components
) {
my $column_width = Catalyst::Utils::term_width() - 8 - 9;
my $t = Text::SimpleTable->new( [ $column_width, 'Class' ], [ 8, 'Type' ] );
- $t->row( @$_ ) for @comps_names_types;
+ $t->row( $_ => ref($comps) ? 'instance' : 'class' ) for keys %comps;
$class->log->debug( "Loaded components:\n" . $t->draw . "\n" );
}