| 1 | package DBM_Filter::int32 ; |
| 2 | |
| 3 | use strict; |
| 4 | use warnings; |
| 5 | |
| 6 | our $VERSION = '0.01'; |
| 7 | |
| 8 | # todo get Filter to figure endian. |
| 9 | |
| 10 | sub Store |
| 11 | { |
| 12 | $_ = 0 if ! defined $_ || $_ eq "" ; |
| 13 | $_ = pack("i", $_); |
| 14 | } |
| 15 | |
| 16 | sub Fetch |
| 17 | { |
| 18 | no warnings 'uninitialized'; |
| 19 | $_ = unpack("i", $_); |
| 20 | } |
| 21 | |
| 22 | 1; |
| 23 | |
| 24 | __END__ |
| 25 | |
| 26 | =head1 DBM_Filter::int32 |
| 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('int32'); |
| 35 | |
| 36 | =head1 DESCRIPTION |
| 37 | |
| 38 | This DBM filter is used when interoperating with a C/C++ application |
| 39 | that uses a C int as either the key and/or value in the DBM file. |
| 40 | |
| 41 | =head1 SEE ALSO |
| 42 | |
| 43 | L<DBM_Filter>, L<perldbmfilter> |
| 44 | |
| 45 | =head1 AUTHOR |
| 46 | |
| 47 | Paul Marquess pmqs@cpan.org |
| 48 | |