From: Yuval Kogman Date: Thu, 17 Sep 2009 11:47:04 +0000 (+0300) Subject: Force parsing of blessed() as a function X-Git-Tag: 0.91~5 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=353a8c6850742f5ca13a47c229b0717a323009a9;p=gitmo%2FMoose.git Force parsing of blessed() as a function In the generated constructor it was parsed and invoked as an indirect method, which worked for classes that did not remove C or define it as an accessor. This broke Search::GIN which had a class that used namespace::clean and had a 'blessed' attribute which was incorrectly invoked on the class. --- diff --git a/lib/Moose/Meta/Method/Constructor.pm b/lib/Moose/Meta/Method/Constructor.pm index aecd683..af6a1b4 100644 --- a/lib/Moose/Meta/Method/Constructor.pm +++ b/lib/Moose/Meta/Method/Constructor.pm @@ -58,7 +58,7 @@ sub _initialize_body { $source .= "\n" . 'my $_instance = shift;'; $source .= "\n" . q{Carp::cluck 'Calling new() on an instance is deprecated,' - . ' please use (blessed $obj)->new' if blessed $_instance;}; + . ' please use (blessed $obj)->new' if Scalar::Util::blessed($_instance);}; $source .= "\n" . 'my $class = Scalar::Util::blessed($_instance) || $_instance;';