10 use Mouse::Meta::Role;
17 my $meta = Mouse::Meta::Role->initialize($CALLER);
22 confess "Role does not currently support 'extends'";
30 $caller->meta->add_before_method_modifier($_ => $code);
39 $caller->meta->add_before_method_modifier($_ => $code);
48 $caller->meta->add_before_method_modifier($_ => $code);
58 $caller->meta->add_attribute($name => \%opts);
63 confess "Role does not currently support 'with'";
73 return \&Scalar::Util::blessed;
76 return \&Carp::confess;
80 my $exporter = Sub::Exporter::build_exporter({
82 groups => { default => [':all'] },
98 for my $keyword (keys %exports) {
99 next if $keyword eq 'meta'; # we don't delete this one
100 delete ${ $caller . '::' }{$keyword};
115 =head2 meta -> Mouse::Meta::Role
117 Returns this role's metaclass instance.
119 =head2 before (method|methods) => Code
121 Sets up a "before" method modifier. See L<Moose/before> or
122 L<Class::Method::Modifiers/before>.
124 =head2 after (method|methods) => Code
126 Sets up an "after" method modifier. See L<Moose/after> or
127 L<Class::Method::Modifiers/after>.
129 =head2 around (method|methods) => Code
131 Sets up an "around" method modifier. See L<Moose/around> or
132 L<Class::Method::Modifiers/around>.
134 =head2 has (name|names) => parameters
136 Sets up an attribute (or if passed an arrayref of names, multiple attributes) to
137 this role. See L<Mouse/has>.
139 =head2 confess error -> BOOM
141 L<Carp/confess> for your convenience.
143 =head2 blessed value -> ClassName | undef
145 L<Scalar::Util/blessed> for your convenience.
151 Importing Mouse::Role will give you sugar.
155 Please unimport Mouse (C<no Mouse::Role>) so that if someone calls one of the
156 keywords (such as L</has>) it will break loudly instead breaking subtly.