ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/staticperl/perl/lib/DBM_Filter/utf8.pm
Revision: 1.1
Committed: Thu Jun 30 14:27:10 2005 UTC (21 years, 5 months ago) by root
Branch: MAIN
CVS Tags: PERL-5-8-7, HEAD
Branch point for: PERL
Log Message:
*** empty log message ***

File Contents

# Content
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 pmqs@cpan.org
50