15 # Defining this causes the FIRST call to Baz->new w/o param to fail,
16 # if no call to ANY Moo::Object->new was done before.
19 # ... Moo (kinda) eats exceptions in DESTROY/DEMOLISH";
24 my $obj = eval { Foo->new; };
25 like( $@, qr/Missing required arguments/, "... Foo plain" );
26 is( $obj, undef, "... the object is undef" );
32 sub new { die "Bar died"; }
35 die "Vanilla Perl eats exceptions in DESTROY too";
40 my $obj = eval { Bar->new; };
41 like( $@, qr/Bar died/, "... Bar plain" );
42 is( $obj, undef, "... the object is undef" );
62 is( $@, 42, '$@ is still 42 after object is demolished without dying' );
63 is( $?, 84, '$? is still 84 after object is demolished without dying' );
71 is( $@, 0, '$@ is still 0 after object is demolished without dying' );