biblatex and biber

Norbert Preining preining at logic.at
Thu Aug 29 05:01:26 UTC 2013


On Do, 29 Aug 2013, Danai SAE-HAN (韓達耐) wrote:
> I raised the issue with the Biber authors but Diver is a. integral part of
> Biber.
> 
> Maybe we have to figure out some non-free workaround?

No, what about the patch I pushed to the biber-norb repo
which removes the dependency on data-diver completely
by providing a Dive function (written by me only based one
the specification):

Patch included in email.

I do not guarantee that this works, but from my analysis of the
code the biber modules only use Dive to dereference arrays
and make sure that undef is returned if not found.

That is easy to implement without all the bells and whistles in
Data::Diver::Dive.

Please review.

I would like to test, but unfortunately too many modules are still
not updated for perl 5.18 so biber cannot be build:
(I locally updated libtext-bibtex...)

Norbert

------------------------------------------------------------------------
PREINING, Norbert                               http://www.preining.info
JAIST, Japan                                 TeX Live & Debian Developer
DSA: 0x09C5B094   fp: 14DF 2E6C 0307 BE6D AD76  A9C0 D2BF 4AA3 09C5 B094
------------------------------------------------------------------------
-------------- next part --------------
Description: remove requirement for Data::Diver, provide our own Dive function
Origin: vendor
Forwarded: maybe
Author: Norbert Preining <preining at debian.org>
Last-Update: 2013-08-29
---
 Build.PL               |    1 -
 META.json              |    1 -
 META.yml               |    1 -
 lib/Biber/Entry.pm     |    1 -
 lib/Biber/Internals.pm |    1 -
 lib/Biber/Utils.pm     |   22 ++++++++++++++++++++++
 6 files changed, 22 insertions(+), 5 deletions(-)

--- biber-norb.git.orig/Build.PL
+++ biber-norb.git/Build.PL
@@ -42,7 +42,6 @@
     requires => {
         'Data::Dump' => 0,
         'Data::Compare' => 0,
-        'Data::Diver' => 0,
         'Date::Simple' => 0,
         'File::Slurp::Unicode'  => 0,
         'IPC::Cmd' => 0,
--- biber-norb.git.orig/META.json
+++ biber-norb.git/META.json
@@ -34,7 +34,6 @@
             "Business::ISMN" : "0",
             "Business::ISSN" : "0",
             "Data::Compare" : "0",
-            "Data::Diver" : "0",
             "Data::Dump" : "0",
             "Date::Simple" : "0",
             "Encode::EUCJPASCII" : "0",
--- biber-norb.git.orig/META.yml
+++ biber-norb.git/META.yml
@@ -72,7 +72,6 @@
   Business::ISMN: 0
   Business::ISSN: 0
   Data::Compare: 0
-  Data::Diver: 0
   Data::Dump: 0
   Date::Simple: 0
   Encode::EUCJPASCII: 0
--- biber-norb.git.orig/lib/Biber/Entry.pm
+++ biber-norb.git/lib/Biber/Entry.pm
@@ -6,7 +6,6 @@
 use Biber::Utils;
 use Biber::Internals;
 use Biber::Constants;
-use Data::Diver qw( Dive );
 use Data::Dump qw( pp );
 use Digest::MD5 qw( md5_hex );
 use Log::Log4perl qw( :no_extra_logdie_message );
--- biber-norb.git.orig/lib/Biber/Internals.pm
+++ biber-norb.git/lib/Biber/Internals.pm
@@ -8,7 +8,6 @@
 use Biber::Utils;
 use Biber::DataModel;
 use Data::Compare;
-use Data::Diver qw( Dive );
 use List::AllUtils qw( :all );
 use Log::Log4perl qw(:no_extra_logdie_message);
 use Digest::MD5 qw( md5_hex );
--- biber-norb.git.orig/lib/Biber/Utils.pm
+++ biber-norb.git/lib/Biber/Utils.pm
@@ -44,6 +44,7 @@
   is_def is_undef is_def_and_notnull is_def_and_null
   is_undef_or_null is_notnull is_null normalise_utf8 inits join_name latex_recode_output
   filter_entry_options biber_error biber_warn ireplace imatch validate_biber_xml
+  Dive
   process_entry_options escape_label unescape_label biber_decode_utf8 out};
 
 =head1 FUNCTIONS
@@ -955,6 +956,27 @@
   return;
 }
 
+=head2 Dive
+
+  A minimal implementation of Data::Diver since this one cannot be
+  included in Debian due to license issues.
+  
+  Pulls out one value from a nested data structure.
+
+=cut
+
+sub Dive {
+  my ($ref, @keys) = @_;
+  return unless defined($ref);
+  for my $k (@keys) {
+    if ($k =~ m/^-?\d+$/) {
+      $ref = $ref->[$k];
+    } else {
+      $ref = $ref->{$k};
+    }
+  }
+  return $ref;
+}
 
 1;
 


More information about the pkg-perl-maintainers mailing list