diff options
author | Gianni Ceccarelli <dakkar@thenautilus.net> | 2011-11-10 11:13:52 +0000 |
---|---|---|
committer | Gianni Ceccarelli <dakkar@thenautilus.net> | 2011-11-10 11:13:52 +0000 |
commit | 515e2e42c4d82dadfcca0762db8ad13781a4ca80 (patch) | |
tree | 1e54613f46a76310c4a412accdbf54001ffb1bc6 /Data-MultiValued/lib/Data/MultiValued/AttributeTrait | |
parent | utility meta-accessors (diff) | |
download | data-multivalued-515e2e42c4d82dadfcca0762db8ad13781a4ca80.tar.gz data-multivalued-515e2e42c4d82dadfcca0762db8ad13781a4ca80.tar.bz2 data-multivalued-515e2e42c4d82dadfcca0762db8ad13781a4ca80.zip |
"fast" hash/bless for serialization
Diffstat (limited to 'Data-MultiValued/lib/Data/MultiValued/AttributeTrait')
-rw-r--r-- | Data-MultiValued/lib/Data/MultiValued/AttributeTrait/Tagged.pm | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/Data-MultiValued/lib/Data/MultiValued/AttributeTrait/Tagged.pm b/Data-MultiValued/lib/Data/MultiValued/AttributeTrait/Tagged.pm index 7839e2d..2a45506 100644 --- a/Data-MultiValued/lib/Data/MultiValued/AttributeTrait/Tagged.pm +++ b/Data-MultiValued/lib/Data/MultiValued/AttributeTrait/Tagged.pm @@ -187,6 +187,25 @@ sub get_tagged_write_method { return $self->get_write_method . '_tagged'; } +sub _rebless_slot { + my ($self,$instance) = @_; + + my $st = $self->get_full_storage($instance); + return unless $st; + + bless $st, 'Data::MultiValued::Tags'; + $st->_rebless_storage; +} + +sub _as_hash { + my ($self,$instance) = @_; + + my $st = $self->get_full_storage($instance); + return unless $st; + + return $st->_as_hash; +} + package Moose::Meta::Attribute::Custom::Trait::MultiValued::Tagged;{ sub register_implementation { 'Data::MultiValued::AttributeTrait::Tagged' } } |