X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo%2FMouse.git;a=blobdiff_plain;f=lib%2FMouse.pm;h=b97cf1e1ecfaeca641881ff0d2e2ef1dab1b693b;hp=172360aa2414ebe08f000a5ff756c9c8d63fbf68;hb=refs%2Ftags%2F0.50_04;hpb=bd76a699d654075009bb9fd707021721eecf8299 diff --git a/lib/Mouse.pm b/lib/Mouse.pm index 172360a..b97cf1e 100644 --- a/lib/Mouse.pm +++ b/lib/Mouse.pm @@ -3,12 +3,12 @@ use 5.006_002; use Mouse::Exporter; # enables strict and warnings -our $VERSION = '0.47'; +our $VERSION = '0.50_04'; use Carp qw(confess); use Scalar::Util qw(blessed); -use Mouse::Util qw(load_class is_class_loaded get_code_package not_supported); +use Mouse::Util (); use Mouse::Meta::Module; use Mouse::Meta::Class; @@ -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.47 +This document describes Mouse version 0.50_04 =head1 SYNOPSIS @@ -182,6 +176,9 @@ This document describes Mouse version 0.47 $self->y(0); } + + __PACKAGE__->meta->make_immutable(); + package Point3D; use Mouse; @@ -194,6 +191,8 @@ This document describes Mouse version 0.47 $self->z(0); }; + __PACKAGE__->meta->make_immutable(); + =head1 DESCRIPTION L is wonderful. B @@ -213,10 +212,9 @@ B except for testing modules. =head2 MOOSE COMPATIBILITY -Compatibility with Moose has been the utmost concern. Fewer than 1% of the -tests fail when run against Moose instead of Mouse. Mouse code coverage is also -over 96%. Even the error messages are taken from Moose. The Mouse code just -runs the test suite 4x faster. +Compatibility with Moose has been the utmost concern. The sugary interface is +highly compatible with Moose. Even the error messages are taken from Moose. +The Mouse code just runs the test suite 4x faster. The idea is that, if you need the extra power, you should be able to run C on your codebase and have nothing break. To that end, @@ -227,7 +225,7 @@ Moose, if you run into weird errors, it would be worth running: ANY_MOOSE=Moose perl your-script.pl to see if the bug is caused by Mouse. Moose's diagnostics and validation are -also much better. +also better. See also L for compatibility and incompatibility with Moose. @@ -249,15 +247,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.