This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Upgrade to I18N::LangTags 0.31.
[perl5.git] / lib / DBM_Filter / compress.pm
1 package DBM_Filter::compress ;
2
3 use strict;
4 use warnings;
5 use Carp;
6
7 our $VERSION = '0.01';
8
9 BEGIN
10 {
11     eval { require Compress::Zlib; Compress::Zlib->import() };
12
13     croak "Compress::Zlib module not found.\n"
14         if $@;
15 }
16
17
18
19 sub Store { $_ = compress($_) }
20 sub Fetch { $_ = uncompress($_) }
21
22 1;
23
24 __END__
25
26 =head1 DBM_Filter::compress
27
28 =head1 SYNOPSIS
29
30     use SDBM_File; # or DB_File, or GDBM_File, or NDBM_File, or ODBM_File
31     use DBM_Filter ;
32
33     $db = tie %hash, ...
34     $db->Filter_Push('compress');
35     
36 =head1 DESCRIPTION
37
38 This DBM filter will compress all data before it is written to the database
39 and uncompressed it on reading.
40
41 A fatal error will be thrown if the Compress::Zlib module is not
42 available.
43
44 =head1 SEE ALSO
45
46 L<DBM_Filter>, L<perldbmfilter>, L<Compress::Zlib>
47
48 =head1 AUTHOR
49
50 Paul Marquess pmqs@cpan.org
51