use strict;
use warnings;
-use Test::More tests => 67;
+use Test::More tests => 70;
use Test::Exception;
use Scalar::Util qw/reftype/;
}
);
- $meta->add_method( 'new', sub { return bless {}, shift } );
+ sub new {
+ return bless {}, shift;
+ }
}
{
is(
$o->{custom_store}, $str,
- 'Custom glob-assignment-created accessor is still method modifier is added'
+ 'Custom glob-assignment-created accessor still has method modifier'
);
}
+
+{
+ # Since the sub reference below is not a closure, Perl caches it and uses
+ # the same reference each time through the loop. See RT #48985 for the
+ # bug.
+ foreach my $ns ( qw( Foo2 Bar2 Baz2 ) ) {
+ my $meta = Class::MOP::Class->create($ns);
+
+ my $sub = sub { };
+
+ $meta->add_method( 'foo', $sub );
+
+ my $method = $meta->get_method('foo');
+ ok( $method, 'Got the foo method back' );
+ }
+}