X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo%2FMouse.git;a=blobdiff_plain;f=lib%2FMouse.pm;h=22827e57a0a6cfb5720ad50c03586ef4ad85740e;hp=6099c97736f68461d276c4112e8c84d1d0967ed5;hb=7fa0bc1b549deaa7f089c75b491877ed552f4f53;hpb=95ce77e0b3a80df1d1ff2a7111496b8dbeed0671 diff --git a/lib/Mouse.pm b/lib/Mouse.pm index 6099c97..22827e5 100644 --- a/lib/Mouse.pm +++ b/lib/Mouse.pm @@ -3,7 +3,7 @@ use 5.006_002; use Mouse::Exporter; # enables strict and warnings -our $VERSION = '0.4501'; +our $VERSION = '0.50_01'; 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.4501 +This document describes Mouse version 0.50_01 =head1 SYNOPSIS @@ -182,6 +176,9 @@ This document describes Mouse version 0.4501 $self->y(0); } + + __PACKAGE__->meta->make_immutable(); + package Point3D; use Mouse; @@ -194,6 +191,8 @@ This document describes Mouse version 0.4501 $self->z(0); }; + __PACKAGE__->meta->make_immutable(); + =head1 DESCRIPTION L is wonderful. B @@ -249,15 +248,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. -=head2 C<< after (method|methods) => CodeRef >> +=head2 C<< after (method|methods|regexp) => CodeRef >> Installs an "after" method modifier. See L. -=head2 C<< around (method|methods) => CodeRef >> +=head2 C<< around (method|methods|regexp) => CodeRef >> Installs an "around" method modifier. See L. @@ -402,6 +401,22 @@ 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: