Commit | Line | Data |
---|---|---|
735d5df8 | 1 | |
2 | Add a &reverse_method_lookup to MooseX::AttributeHelpers::Base which | |
3 | given a name of a providable method will return the method name chosen | |
4 | by the consumer of the module. Something like this. | |
5 | ||
6 | has +method => (default => sub { | |
7 | return +{ | |
8 | 'foo' => sub { | |
9 | my ($attr, $reader, $writer) = @_; | |
10 | my $bar_method_name = $attr->reverse_method_lookup('bar'); | |
11 | return sub { | |
12 | $_[0]->$bar_method_name() | |
13 | } | |
14 | }, | |
15 | 'bar' => sub { | |
16 | ... | |
17 | } | |
18 | } | |
19 | }) | |
20 |