Line | |
---|
1 | package DBM_Filter::utf8 ;
|
---|
2 |
|
---|
3 | use strict;
|
---|
4 | use warnings;
|
---|
5 | use Carp;
|
---|
6 |
|
---|
7 | our $VERSION = '0.01';
|
---|
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 |
|
---|
25 | =head1 DBM_Filter::utf8
|
---|
26 |
|
---|
27 | =head1 SYNOPSIS
|
---|
28 |
|
---|
29 | use SDBM_File; # or DB_File, or GDBM_File, or NDBM_File, or ODBM_File
|
---|
30 | use DBM_Filter ;
|
---|
31 |
|
---|
32 |
|
---|
33 | $db = tie %hash, ...
|
---|
34 | $db->Filter_Push('utf8');
|
---|
35 |
|
---|
36 | =head1 DESCRIPTION
|
---|
37 |
|
---|
38 | This Filter will ensure that all data written to the DBM will be encoded
|
---|
39 | in UTF-8.
|
---|
40 |
|
---|
41 | This module uses the Encode module.
|
---|
42 |
|
---|
43 | =head1 SEE ALSO
|
---|
44 |
|
---|
45 | L<DBM_Filter>, L<perldbmfilter>, L<Encode>
|
---|
46 |
|
---|
47 | =head1 AUTHOR
|
---|
48 |
|
---|
49 | Paul Marquess [email protected]
|
---|
50 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.