return if !$serial_id;
# mortal anonymous class
+ # XXX: cleaning stash with threads causes panic/SEGV.
+ if(exists $INC{'threads.pm'}) {
+ # (caller)[2] indicates the caller's line number,
+ # which is zero when the current thread is joining.
+ return if( (caller)[2] == 0);
+ }
+
# @ISA is a magical variable, so we clear it manually.
@{$self->{superclasses}} = () if exists $self->{superclasses};
delete $METAS{$name};
$name =~ s/ $serial_id \z//xms;
-
no strict 'refs';
delete ${$name}{ $serial_id . '::' };
use warnings;
use constant HAS_THREADS => eval{ require threads };
-use Test::More HAS_THREADS ? (tests => 6) : (skip_all => "This is a test for threads ($@)");
+use if !HAS_THREADS, 'Test::More', (skip_all => "This is a test for threads ($@)");
+use Test::More;
{
+ package MyTraits;
+ use Mouse::Role;
+
package MyClass;
use Mouse;
has value => (
is => 'rw',
+ isa => 'Int',
+
+ traits => [qw(MyTraits)],
);
}
})->join();
is $o->foo->value, 42;
+
+$o = MyClass->new(foo => Foo->new(value => 43));
+is $o->foo->value, 43;
+
ok !$o->meta->is_immutable;
+done_testing;