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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.