Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

A Moose role of roles

Tags:

roles

perl

moose

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?

like image 531
Schwern Avatar asked Jan 21 '23 13:01

Schwern


1 Answers

package WithContacts;

use Moose::Role;
with qw(WithAddress WithPhone);

# anything else your role should do

no Moose::Role;
1;
like image 53
cjm Avatar answered Feb 01 '23 13:02

cjm