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(@_)';
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;
+++ /dev/null
-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;
-}