Remove the & prototype hack now Moose::Exporter doesn't throw prototypes away anymore.
[gitmo/MooseX-Role-Parameterized.git] / lib / MooseX / Role / Parameterized.pm
index bfdb308..ed28f9f 100644 (file)
@@ -21,6 +21,10 @@ __PACKAGE__->setup_import_methods(
 
 sub parameter {
     my $caller = shift;
+
+    confess "'parameter' may not be used inside of the role block"
+        if $CURRENT_METACLASS;
+
     my $meta   = Class::MOP::Class->initialize($caller);
 
     my $names = shift;
@@ -31,7 +35,7 @@ sub parameter {
     }
 }
 
-sub role {
+sub role (&) {
     my $caller         = shift;
     my $role_generator = shift;
     Class::MOP::Class->initialize($caller)->role_generator($role_generator);
@@ -45,18 +49,6 @@ sub init_meta {
     );
 }
 
-# give role a (&) prototype
-moose_around _make_wrapper => sub {
-    my $orig = shift;
-    my ($self, $caller, $sub, $fq_name) = @_;
-
-    if ($fq_name =~ /::role$/) {
-        return sub (&) { $sub->($caller, @_) };
-    }
-
-    return $orig->(@_);
-};
-
 sub has {
     my $caller = shift;
     my $meta   = $CURRENT_METACLASS || Class::MOP::Class->initialize($caller);
@@ -187,7 +179,6 @@ MooseX::Role::Parameterized - parameterized roles
     use MooseX::Role::Parameterized;
 
     parameter name => (
-        is       => 'ro',
         isa      => 'Str',
         required => 1,
     );
@@ -230,8 +221,9 @@ Your parameterized role consists of two things: parameter declarations and a
 C<role> block.
 
 Parameters are declared using the L</parameter> keyword which very much
-resembles L<Moose/has>. You can use any option that L<Moose/has> accepts.
-These parameters will get their values when the consuming class (or role) uses
+resembles L<Moose/has>. You can use any option that L<Moose/has> accepts. The
+default value for the "is" option is "ro" as that's a very common case. These
+parameters will get their values when the consuming class (or role) uses
 L<Moose/with>. A parameter object will be constructed with these values, and
 passed to the C<role> block.
 
@@ -260,5 +252,29 @@ C<excludes> is an error.
 
 Shawn M Moore, C<< <sartak@bestpractical.com> >>
 
+=head1 EXAMPLES
+
+=over 4
+
+=item L<MooseX::Role::Matcher>
+
+=item L<MooseX::Role::RelatedClassRoles>
+
+=item L<MooseX::Role::XMLRPC::Client>
+
+=item L<WWW::Mechanize::TreeBuilder>
+
+=item L<TAEB::Action::Role::Item>
+
+=item L<KiokuDB::Role::Scan>
+
+=item L<Fey::Role::MakesAliasObjects>
+
+=item L<Fey::Role::HasAliasName>
+
+=item L<Fey::Role::SetOperation>
+
+=back
+
 =cut