is => 'rw',
default => sub{
- # Those eval()s which try to load missing modules in
- # compile-time triggers a Perl bug (Ticket #69939).
- # This is related not only to Mouse, but also to tie-modules.
+ # Ticket #69939
+ # See the Mouse manpage
- #eval 'use MayNotBeInstalled'; # NG
- #eval 'BEGIN{ require MayNotBeInstalled }'; # NG
- eval{ eval 'use MayNotBeInstalled' }; # OK
+ #eval 'BEGIN{ die }'; # NG
+ eval{ eval 'BEGIN{ die }' }; # OK
::pass 'in a default callback';
},
);
=head1 CAVEATS
-If you use Mouse::XS you might see a silent fatal error when you use
-callbacks which include C<eval 'use MayNotBeInstalled'>. This is not
+If you use Mouse::XS you might see a fatal error on callbacks
+which include C<eval 'BEGIN{ die }'>, which typically occurs in sutch code
+like 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 MayNotBeInstalled'; # NG
- eval{ eval 'use MayNotBeInstalled' }; # OK
+ # eval 'use NotInstalledModule'; # NG
+ eval{ eval 'use NotInstalledModule' }; # OK
}
It seems ridiculous, but it works as you expected.