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