Next Lightweight Databases 91

Filters

        use Storable;
        $hash{numbers} = freeze [1, 4, 2, 8, 5, 7];
        $aref = thaw $hash{numbers};
        print "@$aref\n";
        1 4 2 8 5 7
        my $db = tied %hash;
        $db->filter_store_value(sub { $_ = Storable::freeze($_) });
        $db->filter_fetch_value(sub { $_ = Storable::thaw($_) });
        $hash{numbers} = [1, 4, 2, 8, 5, 7];
        $aref = $hash{numbers};
        print "@$aref\n";


Next Copyright © 2003 M. J. Dominus