X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMoose%2FMeta%2FMethod%2FConstructor.pm;h=e25ae44dc987bf2cfaba9e5fd1d45b74de322591;hb=88c6f7d8b8a9fbfd6f876a61f41b1c78c4d1f045;hp=7e8e2f27bf8ff4c56e0fb809e523dd1838477d38;hpb=5d27ac732591e1bb45270a185f71bb37d91a4a06;p=gitmo%2FMoose.git diff --git a/lib/Moose/Meta/Method/Constructor.pm b/lib/Moose/Meta/Method/Constructor.pm index 7e8e2f2..e25ae44 100644 --- a/lib/Moose/Meta/Method/Constructor.pm +++ b/lib/Moose/Meta/Method/Constructor.pm @@ -6,7 +6,7 @@ use warnings; use Scalar::Util 'blessed', 'weaken', 'looks_like_number', 'refaddr'; -our $VERSION = '0.88'; +our $VERSION = '0.89_02'; our $AUTHORITY = 'cpan:STEVAN'; use base 'Moose::Meta::Method', @@ -43,11 +43,6 @@ sub new { return $self; } -# This is here so can_be_inlined can be inherited by MooseX modules. -sub _expected_constructor_class { - return 'Moose::Object'; -} - ## method sub _initialize_body { @@ -61,6 +56,10 @@ sub _initialize_body { # the author, after all, nothing is free) my $source = 'sub {'; $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;}; + $source .= "\n" . 'my $class = Scalar::Util::blessed($_instance) || $_instance;'; $source .= "\n" . 'return $class->Moose::Object::new(@_)';