Skip Menu |

This queue is for tickets about the MooseX-MethodAttributes CPAN distribution.

Report information
The Basics
Id: 114650
Status: new
Priority: 0/
Queue: MooseX-MethodAttributes

People
Owner: Nobody in particular
Requestors: ribasushi [...] leporine.io
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Does not implement the attributes::get() protocol
The implementation is missing FETCH_CODE_ATTRIBUTE, demonstrated by the following: perl -Ilib -e ' use Data::Dumper; use Moose; use MooseX::MethodAttributes; sub foo :Bar :Baz { rand() }; warn Dumper { via_meta => __PACKAGE__->meta->get_method("foo")->attributes, via_attributes => [ attributes::get( \&foo ) ], }; ' Attached a preliminary, untested, proof-of-concept patch
Subject: prelim_moosex_methodattributes.patch
diff --git a/lib/MooseX/MethodAttributes/Role/AttrContainer.pm b/lib/MooseX/MethodAttributes/Role/AttrContainer.pm index 33f1fcf..5f0dc7a 100644 --- a/lib/MooseX/MethodAttributes/Role/AttrContainer.pm +++ b/lib/MooseX/MethodAttributes/Role/AttrContainer.pm @@ -22,6 +22,17 @@ sub MODIFY_CODE_ATTRIBUTES { return (); } +sub FETCH_CODE_ATTRIBUTES { + my ($class, $code) = @_; + + # disgusting, there ought to be a better way + if ( + my ($method_meta) = grep { $code == $_->body } find_meta($class)->get_all_methods + ) { + @{ $method_meta->attributes || [] }; + } +} + 1; __END__