From: Jesse Luehrs Date: Fri, 9 Oct 2009 00:40:18 +0000 (-0500) Subject: remove the warning for $self->new X-Git-Tag: 0.93~20 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=dd5eb91f3add51306c083e87705567a0ef51640d;p=gitmo%2FMoose.git remove the warning for $self->new --- diff --git a/lib/Moose/Meta/Method/Constructor.pm b/lib/Moose/Meta/Method/Constructor.pm index acba83b..c4ec826 100644 --- a/lib/Moose/Meta/Method/Constructor.pm +++ b/lib/Moose/Meta/Method/Constructor.pm @@ -57,9 +57,6 @@ sub _initialize_body { 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 Scalar::Util::blessed($_instance);}; - $source .= "\n" . 'my $class = Scalar::Util::blessed($_instance) || $_instance;'; $source .= "\n" . 'return $class->Moose::Object::new(@_)'; diff --git a/lib/Moose/Object.pm b/lib/Moose/Object.pm index 1ee0a18..a99f069 100644 --- a/lib/Moose/Object.pm +++ b/lib/Moose/Object.pm @@ -19,9 +19,6 @@ our $AUTHORITY = 'cpan:STEVAN'; sub new { my $class = shift; - Carp::cluck 'Calling new() on an instance is deprecated,' - . ' please use (blessed $obj)->new' if Scalar::Util::blessed($class); - my $params = $class->BUILDARGS(@_); my $real_class = Scalar::Util::blessed($class) || $class; diff --git a/t/010_basics/021-instance-new.t b/t/010_basics/021-instance-new.t deleted file mode 100644 index 3555730..0000000 --- a/t/010_basics/021-instance-new.t +++ /dev/null @@ -1,25 +0,0 @@ -use strict; -use warnings; - -use Test::More; -use Test::Exception; -BEGIN { - eval "use Test::Output;"; - plan skip_all => "Test::Output is required for this test" if $@; - plan tests => 2; -} - -{ - package Foo; - use Moose; -} - -{ - my $foo = Foo->new(); - stderr_like { $foo->new() } - qr/\QCalling new() on an instance is deprecated/, - '$object->new() is deprecated'; - - Foo->meta->make_immutable, redo - if Foo->meta->is_mutable; -}