+++ /dev/null
-#!perl -w
-# See the CAVEATS section in Mouse.pm
-use strict;
-use Test::More;
-
-{
- package Class;
- use Mouse;
-
- has foo => (
- is => 'rw',
-
- default => sub{
- # Ticket #69939
- # See the Mouse manpage
-
- #eval 'BEGIN{ die }'; # NG
- eval{ eval 'BEGIN{ die }' }; # OK
- ::pass 'in a default callback';
- },
- );
-}
-
-pass "class definition has been done";
-
-isa_ok(Class->new, 'Class');
-
-done_testing;
-
Please unimport Mouse (C<no Mouse>) so that if someone calls one of the
keywords (such as L</extends>) it will break loudly instead breaking subtly.
-=head1 CAVEATS
-
-If you use Mouse::XS you might see a fatal error on callbacks
-which include C<eval 'BEGIN{ die }'>, which typically occurs in such code
-as C<eval 'use NotInstalledModule'>. This is not
-a bug in Mouse. In fact, it is a bug in Perl (RT #69939).
-
-To work around this problem, surround C<eval STRING> with C<eval BLOCK>:
-
- sub callback {
- # eval 'use NotInstalledModule'; # NG
- eval{ eval 'use NotInstalledModule' }; # OK
- }
-
-It seems ridiculous, but it works as you expected.
-
=head1 SOURCE CODE ACCESS
We have a public git repository: