Moose is smart enough to delegate only the things that Your::Delegated::Class knows how to handle, minus the things defined locally. It's like AUTOLOAD delegation, done right. I used this on a recent project when what I wanted was inheritance, but had to use composition and delegation.use Moose; use Your::Delegated::Class; has ydc => is => 'ro', lazy_build => 1, handles => qr/.*/, isa => 'You +r::Delegated::Class'; sub _build_ydc { my $self = shift; return Your::Delegated::Class->new; }
-- Randal L. Schwartz, Perl hacker
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.
In reply to Re: Beware of object composition!
by merlyn
in thread Beware of object composition!
by Jenda
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |