From: gfx Date: Sat, 27 Mar 2010 06:42:13 +0000 (+0900) Subject: Remove caveats about RT#69939 X-Git-Tag: 0.52~1 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=84787870ff8a3c5f9ba3af9c60edd6ada26da6da;p=gitmo%2FMouse.git Remove caveats about RT#69939 --- diff --git a/caveats/RT69939.t b/caveats/RT69939.t deleted file mode 100644 index c13fb69..0000000 --- a/caveats/RT69939.t +++ /dev/null @@ -1,29 +0,0 @@ -#!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; - diff --git a/lib/Mouse.pm b/lib/Mouse.pm index 0d6aa8b..7364999 100644 --- a/lib/Mouse.pm +++ b/lib/Mouse.pm @@ -400,22 +400,6 @@ You may use L to replace the superclass list. Please unimport Mouse (C) so that if someone calls one of the keywords (such as L) 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, which typically occurs in such code -as C. This is not -a bug in Mouse. In fact, it is a bug in Perl (RT #69939). - -To work around this problem, surround C with C: - - 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: diff --git a/t/900_bug/006_RT69939t b/t/900_bug/006_RT69939t new file mode 100644 index 0000000..680dee8 --- /dev/null +++ b/t/900_bug/006_RT69939t @@ -0,0 +1,38 @@ +#!perl -w + +package Foo; +use Mouse; + +has bar => ( + is => 'rw', + + trigger => sub { + eval 'BEGIN{ die }'; + }, + default => sub { + eval 'BEGIN{ die }'; + return 42; + }, +); + +sub BUILDARGS { + eval 'BEGIN{ die }'; + return {}; +} + +sub BUILD { + eval 'BEGIN{ die }'; +} + +package main; + +use Test::More tests => 3; + +$@ = '(ERRSV)'; + +my $foo = Foo->new; +isa_ok $foo, 'Foo'; +is $foo->bar, 42; +$foo->bar(100); +is $foo->bar, 100; +note("\$@=$@");