6 use Test::More tests => 7;
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" );
69 is( $@, 0, '$@ is still 0 after object is demolished' );
70 is( $?, 42, '$? is still 42 after object is demolished' );
71 is( $! + 0, 84, '$! is still 84 after object is demolished' );