From: Shawn M Moore Date: Wed, 11 Jun 2008 11:03:08 +0000 (+0000) Subject: Use Class::Method::Modifiers 1.00 for before/after/around X-Git-Tag: 0.04~25 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8517d2ffa37a1201d9bf388d60b23a5daea27272;p=gitmo%2FMouse.git Use Class::Method::Modifiers 1.00 for before/after/around --- diff --git a/Makefile.PL b/Makefile.PL index d6e9fe3..32e566e 100755 --- a/Makefile.PL +++ b/Makefile.PL @@ -6,6 +6,7 @@ all_from 'lib/Mouse.pm'; requires 'Sub::Exporter'; requires 'Scalar::Util'; requires 'MRO::Compat'; +requires 'Class::Method::Modifiers' => '1.00'; build_requires 'Test::More'; build_requires 'Test::Exception'; diff --git a/lib/Mouse.pm b/lib/Mouse.pm index deef2ce..329ed83 100644 --- a/lib/Mouse.pm +++ b/lib/Mouse.pm @@ -9,6 +9,7 @@ use 5.006; use Sub::Exporter; use Carp 'confess'; use Scalar::Util 'blessed'; +use Class::Method::Modifiers (); use Mouse::Meta::Attribute; use Mouse::Meta::Class; @@ -50,6 +51,18 @@ do { blessed => sub { return \&blessed; }, + + before => sub { + return \&Class::Method::Modifiers::before; + }, + + after => sub { + return \&Class::Method::Modifiers::after; + }, + + around => sub { + return \&Class::Method::Modifiers::around; + }, ); my $exporter = Sub::Exporter::build_exporter({ @@ -162,11 +175,10 @@ Version 0.02 released 11 Jun 08 has 'z' => (is => 'rw', isa => 'Int'); - # not implemented yet :) - #after 'clear' => sub { - # my $self = shift; - # $self->z(0); - #}; + after 'clear' => sub { + my $self = shift; + $self->z(0); + }; =head1 DESCRIPTION