| Tie-Filter documentation | Contained in the Tie-Filter distribution. |
Tie::Filter::Hash - Tie a facade around a hash
Don't use this class directly. Instead, use Tie::Filter.
perltie, Tie::Filter
Andrew Sterling Hanenkamp, <sterling@hanenkamp.com>
Copyright 2003 Andrew Sterling Hanenkamp. All Rights Reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
| Tie-Filter documentation | Contained in the Tie-Filter distribution. |
package Tie::Filter::Hash; use 5.008; use strict; use warnings; use Tie::Filter; our $VERSION = '1.02';
sub TIEHASH { my ($class, $hash, %args) = @_; $args{WRAP} = $hash; return bless \%args, $class; } sub FETCH { my ($self, $key) = @_; Tie::Filter::_filter($$self{FETCHVALUE}, $$self{WRAP}{Tie::Filter::_filter($$self{STOREKEY}, $key)}); } sub STORE { my ($self, $key, $value) = @_; $$self{WRAP}{Tie::Filter::_filter($$self{STOREKEY}, $key)} = Tie::Filter::_filter($$self{STOREVALUE}, $value); } sub DELETE { my ($self, $key) = @_; delete $$self{WRAP}{Tie::Filter::_filter($$self{STOREKEY}, $key)}; } sub CLEAR { my $self = shift; %{$$self{WRAP}} = (); } sub EXISTS { my ($self, $key) = @_; exists $$self{WRAP}{Tie::Filter::_filter($$self{STOREKEY}, $key)}; } sub FIRSTKEY { my $self = shift; my $a = keys %{$$self{WRAP}}; if (my ($k) = each %{$$self{WRAP}}) { return (Tie::Filter::_filter($$self{FETCHKEY}, $k)); } else { return (); } } sub NEXTKEY { my $self = shift; if (my ($k) = each %{$$self{WRAP}}) { return (Tie::Filter::_filter($$self{FETCHKEY}, $k)); } else { return (); } } sub UNTIE { } sub DESTROY { }
1