X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst.pm;h=1965ee8a0d285239129ac6d0590e9c8e928f706a;hb=e0bba168bca1f62a196d5f06ba1c7dee3a4f7abc;hp=3928ce9946aa615951c3abe558cada385834cca4;hpb=8cdcc73c0df4e5f58f6d81abd9c3fbd1c15354bf;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst.pm b/lib/Catalyst.pm index 3928ce9..1965ee8 100644 --- a/lib/Catalyst.pm +++ b/lib/Catalyst.pm @@ -758,7 +758,7 @@ sub view { my $container = $c->container->get_sub_container('view'); if ($container->has_service($check)) { - return $c->_filter_component( $container->get_service($check)->get, @args ); + return $c->_filter_component( $container->resolve(service => $check), @args ); } else { $c->log->warn( "Attempted to use view '$check', but does not exist" ); @@ -2453,7 +2453,9 @@ sub setup_actions { my $c = shift; $c->dispatcher->setup_actions( $c, @_ ) } sub setup_config { my $class = shift; - my %args = %{$class->config || {} }; + my %args = %{ $class->config || {} }; + +# FIXME: what is this 'MyApp' doing here? my @container_classes = qw/MyApp::Container Catalyst::Container/; unshift @container_classes, delete $args{container_class} if exists $args{container_class}; @@ -2464,7 +2466,7 @@ sub setup_config { $container->add_sub_container(Bread::Board::Container->new( name => $_ )) for qw(model controller view); $class->container($container); - my $config = $container->fetch('config')->get; + my $config = $container->resolve(service => 'config'); $class->config($config); $class->finalize_config; # back-compat } @@ -2545,9 +2547,9 @@ sub _get_component_type { my @parts = split /::/, $component; for (@parts) { - return 'controller' if /c|controller/i; - return 'model' if /m|model/i; - return 'view' if /v|view/i; + return 'controller' if /^c|controller$/i; + return 'model' if /^m|model$/i; + return 'view' if /^v|view$/i; } } @@ -2621,8 +2623,7 @@ sub setup_component { message => qq/Couldn't instantiate component "$component", "$error"/ ); } - - unless (blessed $instance) { + elsif (!blessed $instance) { my $metaclass = Moose::Util::find_meta($component); my $method_meta = $metaclass->find_method_by_name('COMPONENT'); my $component_method_from = $method_meta->associated_metaclass->name; @@ -2632,6 +2633,7 @@ sub setup_component { qq/Couldn't instantiate component "$component", COMPONENT() method (from $component_method_from) didn't return an object-like value (value was $value)./ ); } + return $instance; }