diff options
author | Jesse Luehrs <doy@tozt.net> | 2011-05-09 02:16:50 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2011-05-09 02:16:50 -0500 |
commit | ea81da0f3d0ace97640a5579fd9755f08a92519b (patch) | |
tree | 5ce006674a7d758dc2ef558f6f6f0e204c48fd6e /lib/MooseX | |
parent | 1ce41cfaf1acdf738cf0eed14011ddf076265ee9 (diff) | |
download | moosex-nonmoose-ea81da0f3d0ace97640a5579fd9755f08a92519b.tar.gz moosex-nonmoose-ea81da0f3d0ace97640a5579fd9755f08a92519b.zip |
fix metaclass reinitialization
Diffstat (limited to 'lib/MooseX')
-rw-r--r-- | lib/MooseX/NonMoose/Meta/Role/Class.pm | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/MooseX/NonMoose/Meta/Role/Class.pm b/lib/MooseX/NonMoose/Meta/Role/Class.pm index 579e618..e873877 100644 --- a/lib/MooseX/NonMoose/Meta/Role/Class.pm +++ b/lib/MooseX/NonMoose/Meta/Role/Class.pm @@ -54,6 +54,25 @@ has constructor_name => ( default => sub { shift->throw_error("No constructor name has been set") }, ); +# XXX ugh, really need to fix this in moose +around reinitialize => sub { + my $orig = shift; + my $class = shift; + my ($pkg) = @_; + + my $meta = blessed($pkg) ? $pkg : Class::MOP::class_of($pkg); + + $class->$orig( + @_, + (map { $_->init_arg => $_->get_value($meta) } + grep { $_->has_value($meta) } + map { $meta->meta->find_attribute_by_name($_) } + qw(has_nonmoose_constructor + has_nonmoose_destructor + constructor_name)), + ); +}; + sub _determine_constructor_options { my $self = shift; my @options = @_; |