X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FClass%2FMOP%2FMixin%2FHasAttributes.pm;h=bf05be2fe35f1c29302fd6bf3f305ed2a17f3511;hb=d004c8d565f9b314da7652e9368aeb4587ffaa3d;hp=9f4c55d99d92325bc02bdf3e475dd1febfe2543f;hpb=9b871d792c4f7ec085870ab705c0ea2b615ebe2d;p=gitmo%2FClass-MOP.git diff --git a/lib/Class/MOP/Mixin/HasAttributes.pm b/lib/Class/MOP/Mixin/HasAttributes.pm index 9f4c55d..bf05be2 100644 --- a/lib/Class/MOP/Mixin/HasAttributes.pm +++ b/lib/Class/MOP/Mixin/HasAttributes.pm @@ -3,7 +3,7 @@ package Class::MOP::Mixin::HasAttributes; use strict; use warnings; -our $VERSION = '0.97'; +our $VERSION = '1.12'; $VERSION = eval $VERSION; our $AUTHORITY = 'cpan:STEVAN'; @@ -12,9 +12,6 @@ use Scalar::Util 'blessed'; use base 'Class::MOP::Mixin'; -sub _attribute_map { $_[0]->{'attributes'} } -sub attribute_metaclass { $_[0]->{'attribute_metaclass'} } - sub add_attribute { my $self = shift; @@ -85,6 +82,18 @@ sub get_attribute_list { keys %{ $self->_attribute_map }; } +sub _restore_metaattributes_from { + my $self = shift; + my ($old_meta) = @_; + + for my $attr (sort { $a->insertion_order <=> $b->insertion_order } + map { $old_meta->get_attribute($_) } + $old_meta->get_attribute_list) { + $attr->_make_compatible_with($self->attribute_metaclass); + $self->add_attribute($attr); + } +} + 1; __END__ @@ -107,7 +116,7 @@ Dave Rolsky Eautarch@urth.orgE =head1 COPYRIGHT AND LICENSE -Copyright 2006-2009 by Infinity Interactive, Inc. +Copyright 2006-2010 by Infinity Interactive, Inc. L