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