19 # Defining this causes the FIRST call to Baz->new w/o param to fail,
20 # if no call to ANY Moose::Object->new was done before.
23 # ... Moose (kinda) eats exceptions in DESTROY/DEMOLISH";
28 my $obj = eval { Foo->new; };
29 like( $@, qr/is required/, "... Foo plain" );
30 is( $obj, undef, "... the object is undef" );
36 sub new { die "Bar died"; }
39 die "Vanilla Perl eats exceptions in DESTROY too";
44 my $obj = eval { Bar->new; };
45 like( $@, qr/Bar died/, "... Bar plain" );
46 is( $obj, undef, "... the object is undef" );
66 is( $@, 42, '$@ is still 42 after object is demolished without dying' );
67 is( $?, 84, '$? is still 84 after object is demolished without dying' );
75 is( $@, 0, '$@ is still 0 after object is demolished without dying' );
77 Baz->meta->make_immutable, redo
78 if Baz->meta->is_mutable