diff options
author | groditi <groditi@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7> | 2009-12-14 21:03:04 +0000 |
---|---|---|
committer | groditi <groditi@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7> | 2009-12-14 21:03:04 +0000 |
commit | f1a74541734521d2b5013bcd577860d98ff727f5 (patch) | |
tree | 81446076153c98a8686df432673f0ee16bb80940 /lib/Reaction/UI/ViewPort/Field/Role/Mutable.pm | |
parent | 26fa3b8aef9774f0ebd25fcbda6297cb263417e9 (diff) | |
parent | a722f3e3e226a7319f69722de01c06792b3cf2c3 (diff) | |
download | reaction-f1a74541734521d2b5013bcd577860d98ff727f5.tar.gz reaction-f1a74541734521d2b5013bcd577860d98ff727f5.zip |
r31712@martha (orig r1247): groditi | 2009-10-02 17:02:01 -0400
whoops compile error
r32396@martha (orig r1251): wreis | 2009-11-04 14:37:47 -0500
undo r1236
r32468@martha (orig r1254): edenc | 2009-11-16 16:48:46 -0500
r15979@debian (orig r1252): edenc | 2009-11-10 21:45:38 -0300
branching for clone-and-inherit workaround
r15980@debian (orig r1253): edenc | 2009-11-10 21:50:34 -0300
working around Moose glitch via parameterized roles
r32469@martha (orig r1255): edenc | 2009-11-16 17:06:25 -0500
added clone and inherit fix to Field::Mutable::HiddenArray
r32618@martha (orig r1256): edenc | 2009-12-04 16:35:06 -0500
fixed hash deref bug in the base controller
Diffstat (limited to 'lib/Reaction/UI/ViewPort/Field/Role/Mutable.pm')
-rw-r--r-- | lib/Reaction/UI/ViewPort/Field/Role/Mutable.pm | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/lib/Reaction/UI/ViewPort/Field/Role/Mutable.pm b/lib/Reaction/UI/ViewPort/Field/Role/Mutable.pm index 94953f4..16ae93f 100644 --- a/lib/Reaction/UI/ViewPort/Field/Role/Mutable.pm +++ b/lib/Reaction/UI/ViewPort/Field/Role/Mutable.pm @@ -1,26 +1,46 @@ package Reaction::UI::ViewPort::Field::Role::Mutable; -use Reaction::Role; +use MooseX::Role::Parameterized; use aliased 'Reaction::InterfaceModel::Action'; use aliased 'Reaction::Meta::InterfaceModel::Action::ParameterAttribute'; use MooseX::Types::Moose qw/Int Str/; - use namespace::clean -except => [ qw(meta) ]; +=pod + +15:24 mst:» I'm not sure I understand why the +foo is overwriting my after'ed clear_value +15:24 mst:» but I would argue it shouldn't do that +15:25 @doy:» because has '+foo' is creating an entirely new attribute +15:25 @doy:» and just copying the meta-attribute's attributes into it +15:25 @doy:» so it's creating a new clearer sub in the subclass +15:27 rafl:» mst: for that case, i tend to just parameterize the role on whatever i might want to override in its attribute definitions + +=cut + +parameter value_type => ( + predicate => 'has_value_type' +); + +role { + +my $p = shift; + has model => (is => 'ro', isa => Action, required => 1); has attribute => (is => 'ro', isa => ParameterAttribute, required => 1); has value => ( - is => 'rw', lazy_build => 1, trigger_adopt('value'), + is => 'rw', lazy_build => 1, trigger => sub { shift->adopt_value }, clearer => 'clear_value', + $p->has_value_type? (isa => $p->value_type) : () ); + has needs_sync => (is => 'rw', isa => Int, default => 0); #should be bool? has message => (is => 'rw', isa => Str, clearer => 'clear_message'); has is_modified => ( #sould be bool? - is => 'ro', writer => '_set_modified', + is => 'ro', writer => '_set_modified', required => 1, default => 1, init_arg => undef ); @@ -111,6 +131,7 @@ sub sync_from_action { around accept_events => sub { ('value', shift->(@_)) }; +}; 1; |