FAQ
In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/c7cd1ed9f82c9c90c5be7e254ba04292d7f07e73?hp=073051a9ae59eaa8dc2e999a8ac61e2577b5f3a4>

- Log -----------------------------------------------------------------
commit c7cd1ed9f82c9c90c5be7e254ba04292d7f07e73
Author: Jarkko Hietaniemi <jhi@iki.fi>
Date: Sun May 15 18:03:33 2016 -0400

     Upgrade to DB_File 1.838 from CPAN.
-----------------------------------------------------------------------

Summary of changes:
  Porting/Maintainers.pl | 2 +-
  cpan/DB_File/DB_File.pm | 58 +++++++++++++++++++++++++++++++++++++++------
  cpan/DB_File/DB_File.xs | 15 ++++++------
  cpan/DB_File/t/db-btree.t | 60 ++++++++++++++++++++++++++---------------------
  4 files changed, 92 insertions(+), 43 deletions(-)

diff --git a/Porting/Maintainers.pl b/Porting/Maintainers.pl
index c118e0e..e6b63bd 100755
--- a/Porting/Maintainers.pl
+++ b/Porting/Maintainers.pl
@@ -330,7 +330,7 @@ use File::Glob qw(:case);
      },

      'DB_File' => {
- 'DISTRIBUTION' => 'PMQS/DB_File-1.835.tar.gz',
+ 'DISTRIBUTION' => 'PMQS/DB_File-1.838.tar.gz',
          'FILES' => q[cpan/DB_File],
          'EXCLUDED' => [
              qr{^patches/},
diff --git a/cpan/DB_File/DB_File.pm b/cpan/DB_File/DB_File.pm
index 9b1f957..8e40902 100644
--- a/cpan/DB_File/DB_File.pm
+++ b/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.838" ;
  $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

diff --git a/cpan/DB_File/DB_File.xs b/cpan/DB_File/DB_File.xs
index 151ec31..f417b22 100644
--- a/cpan/DB_File/DB_File.xs
+++ b/cpan/DB_File/DB_File.xs
@@ -6,7 +6,7 @@

   All comments/suggestions/problems are welcome

- 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.

@@ -270,7 +270,7 @@ typedef db_recno_t recno_t;
  #if DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR < 5
  # define R_SETCURSOR 0x800000
  #else
-# define R_SETCURSOR (-100)
+# define R_SETCURSOR (DB_OPFLAGS_MASK)
  #endif

  #define R_RECNOSYNC 0
@@ -536,7 +536,6 @@ u_int flags ;
      if (flagSet(flags, R_CURSOR)) {
   return ((db->cursor)->c_put)(db->cursor, &key, &value, DB_CURRENT);
      }
-
      if (flagSet(flags, R_SETCURSOR)) {
   if ((db->dbp)->put(db->dbp, NULL, &key, &value, 0) != 0)
    return -1 ;
@@ -1437,10 +1436,10 @@ SV * sv ;
        value = (int)SvIV(*svp) ;

    if (fixed) {
- status = dbp->set_re_pad(dbp, value) ;
+ (void)dbp->set_re_pad(dbp, value) ;
    }
    else {
- status = dbp->set_re_delim(dbp, value) ;
+ (void)dbp->set_re_delim(dbp, value) ;
    }

              }
@@ -1449,12 +1448,12 @@ SV * sv ;
                 svp = hv_fetch(action, "reclen", 6, FALSE);
          if (svp) {
       u_int32_t len = my_SvUV32(*svp) ;
- status = dbp->set_re_len(dbp, len) ;
+ (void)dbp->set_re_len(dbp, len) ;
          }
      }

       if (name != NULL) {
- status = dbp->set_re_source(dbp, name) ;
+ (void)dbp->set_re_source(dbp, name) ;
           name = NULL ;
       }

@@ -1467,7 +1466,7 @@ SV * sv ;
    name = NULL ;


- status = dbp->set_flags(dbp, (u_int32_t)DB_RENUMBER) ;
+ (void)dbp->set_flags(dbp, (u_int32_t)DB_RENUMBER) ;

    if (flags){
               (void)dbp->set_flags(dbp, (u_int32_t)flags) ;
diff --git a/cpan/DB_File/t/db-btree.t b/cpan/DB_File/t/db-btree.t
index fb89a40..4e2968e 100644
--- a/cpan/DB_File/t/db-btree.t
+++ b/cpan/DB_File/t/db-btree.t
@@ -1261,33 +1261,6 @@ EOM

  }

-#{
-# # R_SETCURSOR
-# use strict ;
-# my (%h, $db) ;
-# unlink $Dfile;
-#
-# ok(156, $db = tie(%h, 'DB_File', $Dfile, O_RDWR|O_CREAT, 0640, $DB_BTREE ) );
-#
-# $h{abc} = 33 ;
-# my $k = "newest" ;
-# my $v = 44 ;
-# my $status = $db->put($k, $v, R_SETCURSOR) ;
-# print "status = [$status]\n" ;
-# ok(157, $status == 0) ;
-# $status = $db->del($k, R_CURSOR) ;
-# print "status = [$status]\n" ;
-# ok(158, $status == 0) ;
-# $k = "newest" ;
-# ok(159, $db->get($k, $v, R_CURSOR)) ;
-#
-# ok(160, keys %h == 1) ;
-#
-# undef $db ;
-# untie %h;
-# unlink $Dfile;
-#}
-
  {
      # Bug ID 20001013.009
      #
@@ -1654,4 +1627,37 @@ ok(165,1);
      untie %h;
      unlink $Dfile;
  }
+
+#{
+# # R_SETCURSOR
+# use strict ;
+# my (%h, $db) ;
+# unlink $Dfile;
+#
+# ok 198, $db = tie(%h, 'DB_File', $Dfile, O_RDWR|O_CREAT, 0640, $DB_BTREE ) ;
+#
+# $h{abc} = 33 ;
+# my $k = "newest" ;
+# my $v = 44 ;
+# my $status = $db->put($k, $v, R_SETCURSOR) ;
+# print "status = [$status]\n" ;
+# ok 199, $status == 0 ;
+# $k = $v = '';
+# $status = $db->get($k, $v, R_CURSOR) ;
+# ok 200, $status == 0 ;
+# ok 201, $k eq 'newest';
+# ok 202, $v == 44;
+# $status = $db->del($k, R_CURSOR) ;
+# print "status = [$status]\n" ;
+# ok(203, $status == 0) ;
+# $k = "newest" ;
+# ok(204, $db->get($k, $v, R_CURSOR)) ;
+#
+# ok(205, keys %h == 1) ;
+#
+# undef $db ;
+# untie %h;
+# unlink $Dfile;
+#}
+
  exit ;

--
Perl5 Master Repository

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 1 | next ›
Discussion Overview
groupperl5-changes @
categoriesperl
postedMay 15, '16 at 10:10p
activeMay 15, '16 at 10:10p
posts1
users1
websiteperl.org

1 user in discussion

Jarkko Hietaniemi: 1 post

People

Translate

site design / logo © 2017 Grokbase