perlrolesmoose

A Moose role of roles


I'd like to set up a convenience Moose role made up of other smaller roles. For example, if I have WithAddress and WithPhone I would like a single WithContacts that provides both WithAddress and WithPhone and anything contact methods I add in the future.

How can I do this with Moose?


Solution

  • package WithContacts;
    
    use Moose::Role;
    with qw(WithAddress WithPhone);
    
    # anything else your role should do
    
    no Moose::Role;
    1;