Commit | Line | Data |
d8db2929 |
1 | =head1 NAME |
2 | |
3 | DBM::Deep::Cookbook |
4 | |
5 | =head1 DESCRIPTION |
6 | |
7 | This is the Cookbook for L<DBM::Deep/>. It contains useful tips and tricks, |
8 | plus some examples of how to do common tasks. |
9 | |
10 | =head1 RECIPES |
11 | |
12 | =head2 UTF8 data |
13 | |
14 | When you're using UTF8 data, you may run into the "Wide character in print" |
15 | warning. To fix that in 5.8+, do the following: |
16 | |
17 | my $db = DBM::Deep->new( ... ); |
18 | binmode $db->_fh, ":utf8"; |
19 | |
20 | In 5.6, you will have to do the following: |
21 | |
22 | my $db = DBM::Deep->new( ... ); |
23 | $db->set_filter( 'store_value' => sub { pack "U0C*", unpack "C*", $_[0] } ); |
24 | $db->set_filter( 'retrieve_value' => sub { pack "C*", unpack "U0C*", $_[0] } ); |
25 | |
26 | In a future version, you will be able to specify C<utf8 =E<gt> 1> and |
27 | L<DBM::Deep/> will do these things for you. |
28 | |
29 | =end |