"Fossies" - the Fresh Open Source Software Archive

Member "install-tl-20200916/tlpkg/tlperl/lib/DBM_Filter/utf8.pm" (26 Apr 2015, 777 Bytes) of package /windows/misc/install-tl.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Perl source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 package DBM_Filter::utf8 ;
    2 
    3 use strict;
    4 use warnings;
    5 use Carp;
    6 
    7 our $VERSION = '0.03';
    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 NAME
   26 
   27 DBM_Filter::utf8 - filter for DBM_Filter
   28 
   29 =head1 SYNOPSIS
   30 
   31     use SDBM_File; # or DB_File, GDBM_File, NDBM_File, or ODBM_File
   32     use DBM_Filter;
   33 
   34     $db = tie %hash, ...
   35     $db->Filter_Push('utf8');
   36 
   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