diff options
author | 2019-02-13 21:15:00 +0000 | |
---|---|---|
committer | 2019-02-13 21:15:00 +0000 | |
commit | 9f11ffb7133c203312a01e4b986886bc88c7d74b (patch) | |
tree | 6618511204c614b20256e4ef9dea39a7b311d638 /gnu/usr.bin/perl/cpan/DB_File/DB_File.pm | |
parent | Import perl-5.28.1 (diff) | |
download | wireguard-openbsd-9f11ffb7133c203312a01e4b986886bc88c7d74b.tar.xz wireguard-openbsd-9f11ffb7133c203312a01e4b986886bc88c7d74b.zip |
Fix merge issues, remove excess files - match perl-5.28.1 dist
looking good sthen@, Great! bluhm@
Diffstat (limited to 'gnu/usr.bin/perl/cpan/DB_File/DB_File.pm')
-rw-r--r-- | gnu/usr.bin/perl/cpan/DB_File/DB_File.pm | 58 |
1 files changed, 51 insertions, 7 deletions
diff --git a/gnu/usr.bin/perl/cpan/DB_File/DB_File.pm b/gnu/usr.bin/perl/cpan/DB_File/DB_File.pm index 9b1f9577386..5f4b764bc98 100644 --- a/gnu/usr.bin/perl/cpan/DB_File/DB_File.pm +++ b/gnu/usr.bin/perl/cpan/DB_File/DB_File.pm @@ -2,7 +2,7 @@ # # Written by Paul Marquess (pmqs@cpan.org) # -# Copyright (c) 1995-2014 Paul Marquess. All rights reserved. +# Copyright (c) 1995-2016 Paul Marquess. All rights reserved. # This program is free software; you can redistribute it and/or # modify it under the same terms as Perl itself. @@ -163,7 +163,7 @@ our ($db_version, $use_XSLoader, $splice_end_array_no_length, $splice_end_array, use Carp; -$VERSION = "1.835" ; +$VERSION = "1.840" ; $VERSION = eval $VERSION; # needed for dev releases { @@ -1771,9 +1771,30 @@ R_RECNOSYNC is the only valid flag at present. =head1 DBM FILTERS -A DBM Filter is a piece of code that is be used when you I<always> -want to make the same transformation to all keys and/or values in a -DBM database. +A DBM Filter is a piece of code that is be used when you I<always> want to +make the same transformation to all keys and/or values in a DBM database. +An example is when you need to encode your data in UTF-8 before writing to +the database and then decode the UTF-8 when reading from the database file. + +There are two ways to use a DBM Filter. + +=over 5 + +=item 1. + +Using the low-level API defined below. + +=item 2. + +Using the L<DBM_Filter> module. +This module hides the complexity of the API defined below and comes +with a number of "canned" filters that cover some of the common use-cases. + +=back + +Use of the L<DBM_Filter> module is recommended. + +=head2 DBM Filter Low-level API There are four methods associated with DBM Filters. All work identically, and each is used to install (or uninstall) a single DBM Filter. Each @@ -2182,6 +2203,29 @@ can layer transparently over B<DB_File> to accomplish this feat. Check out the MLDBM module, available on CPAN in the directory F<modules/by-module/MLDBM>. +=head2 What does "wide character in subroutine entry" mean? + +You will usually get this message if you are working with UTF-8 data and +want to read/write it from/to a Berkeley DB database file. + +The easist way to deal with this issue is to use the pre-defined "utf8" +B<DBM_Filter> (see L<DBM_Filter>) that was designed to deal with this +situation. + +The example below shows what you need if I<both> the key and value are +expected to be in UTF-8. + + use DB_File; + use DBM_Filter; + + my $db = tie %h, 'DB_File', '/tmp/try.db', O_CREAT|O_RDWR, 0666, $DB_BTREE; + $db->Filter_Key_Push('utf8'); + $db->Filter_Value_Push('utf8'); + + my $key = "\N{LATIN SMALL LETTER A WITH ACUTE}"; + my $value = "\N{LATIN SMALL LETTER E WITH ACUTE}"; + $h{ $key } = $value; + =head2 What does "Invalid Argument" mean? You will get this error message when one of the parameters in the @@ -2273,7 +2317,7 @@ archive in F<src/misc/db.1.85.tar.gz>. =head1 COPYRIGHT -Copyright (c) 1995-2012 Paul Marquess. All rights reserved. This program +Copyright (c) 1995-2016 Paul Marquess. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. @@ -2300,7 +2344,7 @@ Berkeley DB authors or the author of DB_File. See L<"AUTHOR"> for details. =head1 SEE ALSO L<perl>, L<dbopen(3)>, L<hash(3)>, L<recno(3)>, L<btree(3)>, -L<perldbmfilter> +L<perldbmfilter>, L<DBM_Filter> =head1 AUTHOR |