[Moose-commits] r7333 - in MooseX-Role-Parameterized/trunk:
lib/MooseX/Role/Parameterized/Meta t
sartak at code2.0beta.co.uk
sartak at code2.0beta.co.uk
Sun Jan 18 02:51:24 GMT 2009
Author: sartak
Date: 2009-01-17 18:51:24 -0800 (Sat, 17 Jan 2009)
New Revision: 7333
Modified:
MooseX-Role-Parameterized/trunk/lib/MooseX/Role/Parameterized/Meta/Parameter.pm
MooseX-Role-Parameterized/trunk/t/001-parameters.t
MooseX-Role-Parameterized/trunk/t/002-role-block.t
MooseX-Role-Parameterized/trunk/t/003-apply.t
MooseX-Role-Parameterized/trunk/t/004-with.t
MooseX-Role-Parameterized/trunk/t/005-with-parameterized.t
MooseX-Role-Parameterized/trunk/t/008-method-modifers.t
MooseX-Role-Parameterized/trunk/t/014-compose-parameterizable.t
Log:
Default parameters to read-only
Modified: MooseX-Role-Parameterized/trunk/lib/MooseX/Role/Parameterized/Meta/Parameter.pm
===================================================================
--- MooseX-Role-Parameterized/trunk/lib/MooseX/Role/Parameterized/Meta/Parameter.pm 2009-01-18 02:47:21 UTC (rev 7332)
+++ MooseX-Role-Parameterized/trunk/lib/MooseX/Role/Parameterized/Meta/Parameter.pm 2009-01-18 02:51:24 UTC (rev 7333)
@@ -2,7 +2,21 @@
use Moose;
extends 'Moose::Meta::Attribute';
+# This doesn't actually do anything because _process_options does not consult
+# the default value of "is". hrm.
+has '+is' => (
+ default => 'ro',
+);
+around _process_options => sub {
+ my $orig = shift;
+ my ($class, $name, $options) = @_;
+
+ $options->{is} ||= 'ro';
+
+ $orig->(@_);
+};
+
__PACKAGE__->meta->make_immutable(
inline_constructor => 1,
constructor_name => "_new",
Modified: MooseX-Role-Parameterized/trunk/t/001-parameters.t
===================================================================
--- MooseX-Role-Parameterized/trunk/t/001-parameters.t 2009-01-18 02:47:21 UTC (rev 7332)
+++ MooseX-Role-Parameterized/trunk/t/001-parameters.t 2009-01-18 02:51:24 UTC (rev 7333)
@@ -22,7 +22,6 @@
use MooseX::Role::Parameterized;
parameter length => (
- is => 'ro',
isa => 'Int',
required => 1,
);
Modified: MooseX-Role-Parameterized/trunk/t/002-role-block.t
===================================================================
--- MooseX-Role-Parameterized/trunk/t/002-role-block.t 2009-01-18 02:47:21 UTC (rev 7332)
+++ MooseX-Role-Parameterized/trunk/t/002-role-block.t 2009-01-18 02:51:24 UTC (rev 7333)
@@ -20,7 +20,6 @@
($parameters, %args) = @_;
has age => (
- is => 'ro',
default => $parameters->default_age,
);
Modified: MooseX-Role-Parameterized/trunk/t/003-apply.t
===================================================================
--- MooseX-Role-Parameterized/trunk/t/003-apply.t 2009-01-18 02:47:21 UTC (rev 7332)
+++ MooseX-Role-Parameterized/trunk/t/003-apply.t 2009-01-18 02:51:24 UTC (rev 7333)
@@ -10,20 +10,17 @@
use Moose::Util::TypeConstraints;
parameter format => (
- is => 'ro',
isa => (enum ['Dumper', 'Storable']),
required => 1,
);
parameter freeze_method => (
- is => 'ro',
isa => 'Str',
lazy => 1,
default => sub { "freeze_" . shift->format },
);
parameter thaw_method => (
- is => 'ro',
isa => 'Str',
lazy => 1,
default => sub { "thaw_" . shift->format },
Modified: MooseX-Role-Parameterized/trunk/t/004-with.t
===================================================================
--- MooseX-Role-Parameterized/trunk/t/004-with.t 2009-01-18 02:47:21 UTC (rev 7332)
+++ MooseX-Role-Parameterized/trunk/t/004-with.t 2009-01-18 02:51:24 UTC (rev 7333)
@@ -22,7 +22,6 @@
use MooseX::Role::Parameterized;
parameter slot => (
- is => 'ro',
isa => 'Str',
required => 1,
);
Modified: MooseX-Role-Parameterized/trunk/t/005-with-parameterized.t
===================================================================
--- MooseX-Role-Parameterized/trunk/t/005-with-parameterized.t 2009-01-18 02:47:21 UTC (rev 7332)
+++ MooseX-Role-Parameterized/trunk/t/005-with-parameterized.t 2009-01-18 02:51:24 UTC (rev 7333)
@@ -31,7 +31,6 @@
use MooseX::Role::Parameterized;
parameter slot => (
- is => 'ro',
isa => 'Str',
required => 1,
);
Modified: MooseX-Role-Parameterized/trunk/t/008-method-modifers.t
===================================================================
--- MooseX-Role-Parameterized/trunk/t/008-method-modifers.t 2009-01-18 02:47:21 UTC (rev 7332)
+++ MooseX-Role-Parameterized/trunk/t/008-method-modifers.t 2009-01-18 02:51:24 UTC (rev 7333)
@@ -10,7 +10,6 @@
use MooseX::Role::Parameterized;
parameter method => (
- is => 'ro',
isa => 'Str',
required => 1,
);
Modified: MooseX-Role-Parameterized/trunk/t/014-compose-parameterizable.t
===================================================================
--- MooseX-Role-Parameterized/trunk/t/014-compose-parameterizable.t 2009-01-18 02:47:21 UTC (rev 7332)
+++ MooseX-Role-Parameterized/trunk/t/014-compose-parameterizable.t 2009-01-18 02:51:24 UTC (rev 7333)
@@ -8,7 +8,6 @@
use MooseX::Role::Parameterized;
parameter attribute => (
- is => 'ro',
isa => 'Str',
);
More information about the Moose-commits
mailing list