This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
warnings: fix POD typo "you" → "your"
[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.03';
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 NAME
27
28 DBM_Filter::compress - filter for DBM_Filter
29
30 =head1 SYNOPSIS
31
32     use SDBM_File; # or DB_File, GDBM_File, NDBM_File, ODBM_File
33     use DBM_Filter ;
34
35     $db = tie %hash, ...
36     $db->Filter_Push('compress');
37
38 =head1 DESCRIPTION
39
40 This DBM filter will compress all data before it is written to the database
41 and uncompressed it on reading.
42
43 A fatal error will be thrown if the Compress::Zlib module is not
44 available.
45
46 =head1 SEE ALSO
47
48 L<DBM_Filter>, L<perldbmfilter>, L<Compress::Zlib>
49
50 =head1 AUTHOR
51
52 Paul Marquess pmqs@cpan.org
53