source: for-distributions/trunk/bin/windows/perl/lib/DBM_Filter/utf8.pm@ 14489

Last change on this file since 14489 was 14489, checked in by oranfry, 17 years ago

upgrading to perl 5.8

File size: 763 bytes
Line 
1package DBM_Filter::utf8 ;
2
3use strict;
4use warnings;
5use Carp;
6
7our $VERSION = '0.01';
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 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
38This Filter will ensure that all data written to the DBM will be encoded
39in UTF-8.
40
41This module uses the Encode module.
42
43=head1 SEE ALSO
44
45L<DBM_Filter>, L<perldbmfilter>, L<Encode>
46
47=head1 AUTHOR
48
49Paul Marquess [email protected]
50
Note: See TracBrowser for help on using the repository browser.