Update document
[gitmo/Mouse.git] / lib / Mouse.pm
index cdc8518..a170114 100644 (file)
@@ -3,7 +3,7 @@ use 5.006_002;
 
 use Mouse::Exporter; # enables strict and warnings
 
-our $VERSION = '0.45';
+our $VERSION = '0.50';
 
 use Carp         qw(confess);
 use Scalar::Util qw(blessed);
@@ -61,33 +61,27 @@ sub has {
 
 sub before {
     my $meta = Mouse::Meta::Class->initialize(scalar caller);
-
     my $code = pop;
-
-    for (@_) {
-        $meta->add_before_method_modifier($_ => $code);
+    for my $name($meta->_collect_methods(@_)) {
+        $meta->add_before_method_modifier($name => $code);
     }
     return;
 }
 
 sub after {
     my $meta = Mouse::Meta::Class->initialize(scalar caller);
-
     my $code = pop;
-
-    for (@_) {
-        $meta->add_after_method_modifier($_ => $code);
+    for my $name($meta->_collect_methods(@_)) {
+        $meta->add_after_method_modifier($name => $code);
     }
     return;
 }
 
 sub around {
     my $meta = Mouse::Meta::Class->initialize(scalar caller);
-
     my $code = pop;
-
-    for (@_) {
-        $meta->add_around_method_modifier($_ => $code);
+    for my $name($meta->_collect_methods(@_)) {
+        $meta->add_around_method_modifier($name => $code);
     }
     return;
 }
@@ -166,7 +160,7 @@ Mouse - Moose minus the antlers
 
 =head1 VERSION
 
-This document describes Mouse version 0.45
+This document describes Mouse version 0.50
 
 =head1 SYNOPSIS
 
@@ -249,15 +243,15 @@ Returns this class' metaclass instance.
 
 Sets this class' superclasses.
 
-=head2 C<< before (method|methods) => CodeRef >>
+=head2 C<< before (method|methods|regexp) => CodeRef >>
 
 Installs a "before" method modifier. See L<Moose/before>.
 
-=head2 C<< after (method|methods) => CodeRef >>
+=head2 C<< after (method|methods|regexp) => CodeRef >>
 
 Installs an "after" method modifier. See L<Moose/after>.
 
-=head2 C<< around (method|methods) => CodeRef >>
+=head2 C<< around (method|methods|regexp) => CodeRef >>
 
 Installs an "around" method modifier. See L<Moose/around>.
 
@@ -402,6 +396,22 @@ You may use L</extends> to replace the superclass list.
 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:
@@ -448,7 +458,7 @@ interface at L<http://rt.cpan.org/Public/Dist/Display.html?Name=Mouse>
 
 =head1 COPYRIGHT AND LICENSE
 
-Copyright 2008-2009 Infinity Interactive, Inc.
+Copyright (c) 2008-2010 Infinity Interactive, Inc.
 
 http://www.iinteractive.com/