1package DBM_Filter::utf8 ;
2
3use strict;
4use warnings;
5use Carp;
6
7our $VERSION = '0.03';
8
9BEGIN
10{
11    eval { require Encode; };
12
13    croak "Encode module not found.\n"
14        if $@;
15}
16
17sub Store { $_ = Encode::encode_utf8($_) if defined $_ }
18
19sub Fetch { $_ = Encode::decode_utf8($_) if defined $_ }
20
211;
22
23__END__
24
25=head1 NAME
26
27DBM_Filter::utf8 - filter for DBM_Filter
28
29=head1 SYNOPSIS
30
31    use SDBM_File; # or DB_File, GDBM_File, NDBM_File, or ODBM_File
32    use DBM_Filter;
33
34    $db = tie %hash, ...
35    $db->Filter_Push('utf8');
36
37=head1 DESCRIPTION
38
39This Filter will ensure that all data written to the DBM will be encoded
40in UTF-8.
41
42This module uses the Encode module.
43
44=head1 SEE ALSO
45
46L<DBM_Filter>, L<perldbmfilter>, L<Encode>
47
48=head1 AUTHOR
49
50Paul Marquess pmqs@cpan.org
51
52