chained accessors
[email protected] ("Carl Franks")
| Newsgroups | perl.moose |
|---|---|
| Message-ID | <[email protected]> |
Can anyone give me any pointers to how I might create "chained"
accessors which return $self when called as a setter.
If I do:
has( foo => ( is => 'rw' ) );
I've found using the debugger, that $x->foo('y') calls
Moose::Meta::Method::Accessor::generate_accessor_method()
But I can't figure out how to wrap that (and whether that's the right approach).
What I'd like to be able to do, is only have certain attributes
chained, maybe with something like:
package Foo;
use Moose;
has 'foo' => (is => 'rw', 'metaclass' => 'Foo::Chained::Attribute');
I've looked at t/036_attribute_custom_metaclass.t, but setting the
metaclass doesn't seem to help.
Carl