From: André Walker Date: Tue, 14 Jun 2011 16:05:18 +0000 (-0300) Subject: when COMPONENT dies, one error thrown is enough X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e0bba168bca1f62a196d5f06ba1c7dee3a4f7abc;hp=54f67b25141963430c287464dba556f55ebce86a;p=catagits%2FCatalyst-Runtime.git when COMPONENT dies, one error thrown is enough --- diff --git a/lib/Catalyst.pm b/lib/Catalyst.pm index d250ea7..1965ee8 100644 --- a/lib/Catalyst.pm +++ b/lib/Catalyst.pm @@ -2623,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; @@ -2634,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; }