[Moose-commits] r7335 - in MooseX-Role-Parameterized/trunk/lib/MooseX/Role: . Parameterized

sartak at code2.0beta.co.uk sartak at code2.0beta.co.uk
Sun Jan 18 02:55:12 GMT 2009


Author: sartak
Date: 2009-01-17 18:55:12 -0800 (Sat, 17 Jan 2009)
New Revision: 7335

Modified:
   MooseX-Role-Parameterized/trunk/lib/MooseX/Role/Parameterized.pm
   MooseX-Role-Parameterized/trunk/lib/MooseX/Role/Parameterized/Tutorial.pm
Log:
Document this new default

Modified: MooseX-Role-Parameterized/trunk/lib/MooseX/Role/Parameterized/Tutorial.pm
===================================================================
--- MooseX-Role-Parameterized/trunk/lib/MooseX/Role/Parameterized/Tutorial.pm	2009-01-18 02:55:00 UTC (rev 7334)
+++ MooseX-Role-Parameterized/trunk/lib/MooseX/Role/Parameterized/Tutorial.pm	2009-01-18 02:55:12 UTC (rev 7335)
@@ -47,15 +47,14 @@
 the keyword C<parameter>, but your parameters can use any options to C<has>.
 
     parameter 'delegation' => (
-        is        => 'ro',
         isa       => 'HashRef|ArrayRef|RegexpRef',
         predicate => 'has_delegation',
     );
 
 Behind the scenes, C<parameter> uses C<has> to add attributes to a parameter
-class. The arguments to C<with> are used to construct a parameter object, which
-has the attributes specified by calls to C<parameter>. The parameter object is
-then passed to...
+class (except the "is" option defaults to "ro" for convenience). The arguments
+to C<with> are used to construct a parameter object, which has the attributes
+specified by calls to C<parameter>. The parameter object is then passed to...
 
 =head3 C<role>
 
@@ -89,7 +88,6 @@
 can now also choose type, default value, whether it's required, B<traits>, etc.
 
     parameter traits => (
-        is      => 'ro',
         isa     => 'ArrayRef[Str]',
         default => sub { [] },
     );
@@ -106,7 +104,6 @@
 which attributes to dump to a file.
 
     parameter instrument_method => (
-        is       => 'ro',
         isa      => 'Str',
         required => 1,
     );
@@ -120,7 +117,6 @@
 states.
 
     parameter save_intermediate => (
-        is      => 'ro',
         isa     => 'Bool',
         default => 0,
     );
@@ -137,8 +133,7 @@
 L<Storable>. Which backend to use can be a parameter.
 
     parameter format => (
-        is => 'ro',
-        isa => (enum ['Storable', 'YAML', 'JSON']),
+        isa     => (enum ['Storable', 'YAML', 'JSON']),
         default => 'Storable',
     );
 

Modified: MooseX-Role-Parameterized/trunk/lib/MooseX/Role/Parameterized.pm
===================================================================
--- MooseX-Role-Parameterized/trunk/lib/MooseX/Role/Parameterized.pm	2009-01-18 02:55:00 UTC (rev 7334)
+++ MooseX-Role-Parameterized/trunk/lib/MooseX/Role/Parameterized.pm	2009-01-18 02:55:12 UTC (rev 7335)
@@ -191,7 +191,6 @@
     use MooseX::Role::Parameterized;
 
     parameter name => (
-        is       => 'ro',
         isa      => 'Str',
         required => 1,
     );
@@ -234,8 +233,9 @@
 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.
 




More information about the Moose-commits mailing list