1 package DBM_Filter::encode ;
11 eval { require Encode; };
13 croak "Encode module not found.\n"
20 my $encoding_name = shift || "utf8";
22 my $encoding = Encode::find_encoding($encoding_name) ;
24 croak "Encoding '$encoding_name' is not available"
29 $_ = $encoding->encode($_)
33 $_ = $encoding->decode($_)
43 =head1 DBM_Filter::encode
47 use SDBM_File; # or DB_File, or GDBM_File, or NDBM_File, or ODBM_File
51 $db->Filter_Push('encode' => 'iso-8859-16');
55 This DBM filter allows you to choose the character encoding will be
56 store in the DBM file. The usage is
58 $db->Filter_Push('encode' => ENCODING);
60 where "ENCODING" must be a valid encoding name that the Encode module
63 A fatal error will be thrown if:
69 The Encode module is not available.
73 The encoding requested is not supported by the Encode module.
79 L<DBM_Filter>, L<perldbmfilter>, L<Encode>
83 Paul Marquess pmqs@cpan.org