X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst.pm;h=7368674a6321495d3d69600dd2cc008a1ed46de4;hb=d3e47ea7b725b7889ccff6e11b12ce0520f2758a;hp=9c5bc8cc840cac66477dc743edccb90832eeec58;hpb=4ac0b9cb8e9043db8a95f44af685c782bf9426e7;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst.pm b/lib/Catalyst.pm index 9c5bc8c..7368674 100644 --- a/lib/Catalyst.pm +++ b/lib/Catalyst.pm @@ -43,11 +43,9 @@ sub depth { scalar @{ shift->stack || [] }; } sub comp { shift->component(@_) } sub req { - # carp "the use of req() is deprecated in favour of request()"; my $self = shift; return $self->request(@_); } sub res { - # carp "the use of res() is deprecated in favour of response()"; my $self = shift; return $self->response(@_); } @@ -76,7 +74,7 @@ __PACKAGE__->stats_class('Catalyst::Stats'); # Remember to update this in Catalyst::Runtime as well! -our $VERSION = '5.8000_06'; +our $VERSION = '5.8000_07'; { my $dev_version = $VERSION =~ /_\d{2}$/; @@ -925,9 +923,9 @@ loads and instantiates the given class. MyApp->plugin( 'prototype', 'HTML::Prototype' ); $c->prototype->define_javascript_functions; - + B This method of adding plugins is deprecated. The ability -to add plugins like this B in a Catalyst 5.9. +to add plugins like this B in a Catalyst 5.81. Please do not use this functionality in new code. =cut @@ -935,9 +933,9 @@ Please do not use this functionality in new code. sub plugin { my ( $class, $name, $plugin, @args ) = @_; - # See block comment in t/unit_core_plugin.t + # See block comment in t/unit_core_plugin.t $class->log->warn(qq/Adding plugin using the ->plugin method is deprecated, and will be removed in Catalyst 5.81/); - + $class->_register_plugin( $plugin, 1 ); eval { $plugin->import }; @@ -2181,11 +2179,16 @@ sub setup_component { ); } - Catalyst::Exception->throw( - message => - qq/Couldn't instantiate component "$component", "COMPONENT() didn't return an object-like value"/ - ) unless blessed($instance); - + unless (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; + my $value = defined($instance) ? $instance : 'undef'; + Catalyst::Exception->throw( + message => + qq/Couldn't instantiate component "$component", COMPONENT() method (from $component_method_from) didn't return an object-like value (value was $value)./ + ); + } return $instance; }