croak "Moose::Role cannot support 'augment'";
}
-my $exporter = Moose::Exporter->build_import_methods(
+my $exporter = Moose::Exporter->setup_import_methods(
with_caller => [
qw( with requires excludes has before after around override make_immutable )
],
\&Carp::confess,
\&Scalar::Util::blessed,
],
- also => sub { init_meta(shift) },
);
{
my %METAS;
sub init_meta {
- my $role = shift;
+ shift;
+ my %args = @_;
+
+ my $role = $args{for_class}
+ or confess
+ "Cannot call init_meta without specifying a for_class";
return $METAS{$role} if exists $METAS{$role};
C<unimport> method. You simply have to say C<no Moose::Role> at the bottom of
your code for this to work.
+=head2 B<< Moose::Role->init_meta(for_class => $role, metaclass => $metaclass) >>
+
+The C<init_meta> method sets up the metaclass object for the role
+specified by C<for_class>. It also injects a a C<meta> accessor into
+the role so you can get at this object.
+
+The default metaclass is L<Moose::Meta::Role>. You can specify an
+alternate metaclass with the C<metaclass> parameter.
+
=head1 CAVEATS
Role support has only a few caveats: