filter_store_value#
Install a sub that rewrites every value on its way into the database, so the database holds the rewritten form.
Synopsis#
$db->filter_store_value(sub { $_ = encode('UTF-8', $_) });
$db->filter_store_value(undef); # remove the filter
What you get back#
The filter it replaces, or undef if there was none.
Edge cases#
The sub works on
$_, a copy: your variable keeps its value.A filter that uses the same database croaks
recursion detected in filter_store_value.
Differences from upstream#
Fully compatible with upstream. Covered by t/81-xs-native/DB_File/110-upstream-db-hash.t.
See also#
filter_fetch_value- undoes the rewrite on the way outfilter_store_key- the same for keys