10 use Mouse::Meta::Role;
17 my $meta = Mouse::Meta::Role->initialize($CALLER);
22 confess "Role does not currently support 'extends'";
40 $caller->meta->add_attribute($name => \%opts);
45 confess "Role does not currently support 'with'";
55 return \&Scalar::Util::blessed;
58 return \&Carp::confess;
62 my $exporter = Sub::Exporter::build_exporter({
64 groups => { default => [':all'] },
80 for my $keyword (keys %exports) {
81 next if $keyword eq 'meta'; # we don't delete this one
82 delete ${ $caller . '::' }{$keyword};
97 =head2 meta -> Mouse::Meta::Role
99 Returns this role's metaclass instance.
101 =head2 before (method|methods) => Code
103 Sets up a "before" method modifier. See L<Moose/before> or
104 L<Class::Method::Modifiers/before>.
106 =head2 after (method|methods) => Code
108 Sets up an "after" method modifier. See L<Moose/after> or
109 L<Class::Method::Modifiers/after>.
111 =head2 around (method|methods) => Code
113 Sets up an "around" method modifier. See L<Moose/around> or
114 L<Class::Method::Modifiers/around>.
116 =head2 has (name|names) => parameters
118 Sets up an attribute (or if passed an arrayref of names, multiple attributes) to
119 this role. See L<Mouse/has>.
121 =head2 confess error -> BOOM
123 L<Carp/confess> for your convenience.
125 =head2 blessed value -> ClassName | undef
127 L<Scalar::Util/blessed> for your convenience.
133 Importing Mouse::Role will give you sugar.
137 Please unimport Mouse (C<no Mouse::Role>) so that if someone calls one of the
138 keywords (such as L</has>) it will break loudly instead breaking subtly.