Added introspection methods for method modifiers, along with tests.
[gitmo/Class-MOP.git] / lib / Class / MOP / Method / Wrapped.pm
index c3a355d..883fbcd 100644 (file)
@@ -108,6 +108,11 @@ sub add_before_modifier {
     $_build_wrapped_method->($code->{'modifier_table'});
 }
 
+sub before_modifiers {
+    my $code = shift;
+    return @{$code->{'modifier_table'}->{before}};
+}
+
 sub add_after_modifier {
     my $code     = shift;
     my $modifier = shift;
@@ -115,6 +120,11 @@ sub add_after_modifier {
     $_build_wrapped_method->($code->{'modifier_table'});
 }
 
+sub after_modifiers {
+    my $code = shift;
+    return @{$code->{'modifier_table'}->{after}};
+}
+
 {
     # NOTE:
     # this is another possible candidate for
@@ -142,6 +152,11 @@ sub add_after_modifier {
     }
 }
 
+sub around_modifiers {
+    my $code = shift;
+    return @{$code->{'modifier_table'}->{around}->{methods}};
+}
+
 1;
 
 __END__
@@ -191,6 +206,19 @@ see the section in L<Class::MOP::Class>.
 
 =back
 
+These three methods each returna list of method modifiers I<in the
+order in which they are run>.
+
+=over 4
+
+=item B<before_modifiers>
+
+=item B<after_modifiers>
+
+=item B<around_modifiers>
+
+=back
+
 =head1 AUTHORS
 
 Stevan Little E<lt>stevan@iinteractive.comE<gt>