Objects::Collection::HashUnion - Union hashes.


NAME

 Objects::Collection::HashUnion -  Union hashes.


SYNOPSIS

    use Objects::Collection::HashUnion;
   tie %hashu, 'Objects::Collection::HashUnion', \%hash1, \%hash2;


DESCRIPTION


=cut

use strict; use warnings; use strict; use Carp; use Data::Dumper; require Tie::Hash; use Objects::Collection::Base; @Objects::Collection::HashUnion::ISA = qw(Tie::StdHash Objects::Collection::Base); $Objects::Collection::HashUnion::VERSION = '0.01';

attributes qw( _orig_hashes _for_write __temp_array);

sub Init { my ( $self, @hashes ) = @_; $self->_for_write($hashes[ -1 ]); $self->_orig_hashes(\@hashes); return 1; }

sub _init { my $self = shift; return $self->Init(@_); }

#delete keys only from _for_write hashe! sub DELETE { my ( $self, $key ) = @_; delete $self->_for_write->{ $key }; }

sub STORE { my ( $self, $key, $val ) = @_; my $hashes = $self->_orig_hashes; foreach my $hash ( @$hashes) { next unless exists $hash->{$key}; return $hash->{$key} = $val; } $self->_for_write->{ $key } =$val;


}

_changed

Handle collections key _changed


SEE ALSO

Tie::StdHash


AUTHOR

Zahatski Aliaksandr, <zag@cpan.org>


COPYRIGHT AND LICENSE

Copyright (C) 2005-2006 by Zahatski Aliaksandr

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.

 Objects::Collection::HashUnion - Union hashes.