Moose, in particular MooseX::Declare; however, the docs and error messages can be very confusing. For instance, I was trying to create a class that used two roles and kept getting the following error:expected option name at [path to MooseX/Declare/Syntax/NamespaceHandling.pm] line 45What this meant was that I needed to say:class FooBar with (Fooable, Barable) {}instead of:class FooBar with Fooable, Barable {}Now, I should never have gotten that error if I had followed the docs, so lets see what MooseX::Declare has to say about with:No parentheses there (and no example of multiple roles). How about the
- with
class Foo with Role { ... }Applies a role to the class being declared.
Moose docs then?with (@roles)Well, this has the parentheses, but let's look at how
This will apply a given set of @roles to the local class.
with is used in the examples:Hey! Where are the parentheses? Inpackage MovieCar;
use Moose;
extends 'Car';
with 'Breakable', 'ExplodesOnBreakage';
Moose they are optional, and in MooseX::Declare they are optional if you have only one role, but required if you have more than one.
