eaiovnaovbqoebvqoeavibavo PKIuiZl ]ÍÍnull.pmnu„[µü¤package DBM_Filter::null ; use strict; use warnings; our $VERSION = '0.02'; sub Store { no warnings 'uninitialized'; $_ .= "\x00" ; } sub Fetch { no warnings 'uninitialized'; s/\x00$// ; } 1; __END__ =head1 NAME DBM_Filter::null - filter for DBM_Filter =head1 SYNOPSIS use SDBM_File; # or DB_File, or GDBM_File, or NDBM_File, or ODBM_File use DBM_Filter ; $db = tie %hash, ... $db->Filter_Push('null'); =head1 DESCRIPTION This filter ensures that all data written to the DBM file is null terminated. This is useful when you have a perl script that needs to interoperate with a DBM file that a C program also uses. A fairly common issue is for the C application to include the terminating null in a string when it writes to the DBM file. This filter will ensure that all data written to the DBM file can be read by the C application. =head1 SEE ALSO L, L =head1 AUTHOR Paul Marquess pmqs@cpan.org PKIuiZvÛž@ZZ encode.pmnu„[µü¤package DBM_Filter::encode ; use strict; use warnings; use Carp; our $VERSION = '0.02'; BEGIN { eval { require Encode; }; croak "Encode module not found.\n" if $@; } sub Filter { my $encoding_name = shift || "utf8"; my $encoding = Encode::find_encoding($encoding_name) ; croak "Encoding '$encoding_name' is not available" unless $encoding; return { Store => sub { $_ = $encoding->encode($_) if defined $_ ; }, Fetch => sub { $_ = $encoding->decode($_) if defined $_ ; } } ; } 1; __END__ =head1 NAME DBM_Filter::encode - filter for DBM_Filter =head1 SYNOPSIS use SDBM_File; # or DB_File, or GDBM_File, or NDBM_File, or ODBM_File use DBM_Filter ; $db = tie %hash, ... $db->Filter_Push('encode' => 'iso-8859-16'); =head1 DESCRIPTION This DBM filter allows you to choose the character encoding will be store in the DBM file. The usage is $db->Filter_Push('encode' => ENCODING); where "ENCODING" must be a valid encoding name that the Encode module recognises. A fatal error will be thrown if: =over 5 =item 1 The Encode module is not available. =item 2 The encoding requested is not supported by the Encode module. =back =head1 SEE ALSO L, L, L =head1 AUTHOR Paul Marquess pmqs@cpan.org PKIuiZ‘ä}__ compress.pmnu„[µü¤package DBM_Filter::compress ; use strict; use warnings; use Carp; our $VERSION = '0.02'; BEGIN { eval { require Compress::Zlib; Compress::Zlib->import() }; croak "Compress::Zlib module not found.\n" if $@; } sub Store { $_ = compress($_) } sub Fetch { $_ = uncompress($_) } 1; __END__ =head1 NAME DBM_Filter::compress - filter for DBM_Filter =head1 SYNOPSIS use SDBM_File; # or DB_File, or GDBM_File, or NDBM_File, or ODBM_File use DBM_Filter ; $db = tie %hash, ... $db->Filter_Push('compress'); =head1 DESCRIPTION This DBM filter will compress all data before it is written to the database and uncompressed it on reading. A fatal error will be thrown if the Compress::Zlib module is not available. =head1 SEE ALSO L, L, L =head1 AUTHOR Paul Marquess pmqs@cpan.org PKIuiZ¯´a utf8.pmnu„[µü¤package DBM_Filter::utf8 ; use strict; use warnings; use Carp; our $VERSION = '0.02'; BEGIN { eval { require Encode; }; croak "Encode module not found.\n" if $@; } sub Store { $_ = Encode::encode_utf8($_) if defined $_ } sub Fetch { $_ = Encode::decode_utf8($_) if defined $_ } 1; __END__ =head1 NAME DBM_Filter::utf8 - filter for DBM_Filter =head1 SYNOPSIS use SDBM_File; # or DB_File, or GDBM_File, or NDBM_File, or ODBM_File use DBM_Filter ; $db = tie %hash, ... $db->Filter_Push('utf8'); =head1 DESCRIPTION This Filter will ensure that all data written to the DBM will be encoded in UTF-8. This module uses the Encode module. =head1 SEE ALSO L, L, L =head1 AUTHOR Paul Marquess pmqs@cpan.org PKIuiZ78]øøint32.pmnu„[µü¤package DBM_Filter::int32 ; use strict; use warnings; our $VERSION = '0.02'; # todo get Filter to figure endian. sub Store { $_ = 0 if ! defined $_ || $_ eq "" ; $_ = pack("i", $_); } sub Fetch { no warnings 'uninitialized'; $_ = unpack("i", $_); } 1; __END__ =head1 NAME DBM_Filter::int32 - filter for DBM_Filter =head1 SYNOPSIS use SDBM_File; # or DB_File, or GDBM_File, or NDBM_File, or ODBM_File use DBM_Filter ; $db = tie %hash, ... $db->Filter_Push('int32'); =head1 DESCRIPTION This DBM filter is used when interoperating with a C/C++ application that uses a C int as either the key and/or value in the DBM file. =head1 SEE ALSO L, L =head1 AUTHOR Paul Marquess pmqs@cpan.org PKIuiZl ]ÍÍnull.pmnu„[µü¤PKIuiZvÛž@ZZ encode.pmnu„[µü¤PKIuiZ‘ä}__ — compress.pmnu„[µü¤PKIuiZ¯´a 1 utf8.pmnu„[µü¤PKIuiZ78]øøxint32.pmnu„[µü¤PKj¨