tag 752928 patch
thanks

On Fri, Jun 27, 2014 at 11:14:11PM +0300, Niko Tyni wrote:
> Package: libencode-arabic-perl
> Version: 1.9-1
> Severity: important
> User: [email protected]
> Usertags: perl-5.20-transition
> 
> This package fails to build with a newer Encode version, either on current
> sid with the separate libencode-perl package, or with Perl 5.20.0 from
> experimental. On current sid:
> 
>   #   Failed test 'use Encode::Arabic;'
>   #   at t/00-load.t line 7.
>   #     Tried to use 'Encode::Arabic'.
>   #     Error:  Can't locate object method "export_to_level" via package 
> "Encode" at 
> /tmp/buildd/libencode-arabic-perl-1.9/blib/lib/Encode/Arabic/ArabTeX.pm line 
> 110.

As noted in the upstream ticket, newer versions of Encode don't inherit
from Exporter anymore.

I don't claim to understand all the subtleties here, but I got the test
suite working by using Import::Into. There may well be simpler ways to
fix this, suggestions welcome :)

Note that this also needs a dependency information update, either
Build.PL/META.yml for upstream or debian/control for the packaging Debian.

I couldn't really work out how to use the only reverse dependency,
libelixirfm-perl, so I wasn't able to do any further testing.
-- 
Niko Tyni   [email protected]
>From 66de4096449f3f97f7717f0d832ad90bab543817 Mon Sep 17 00:00:00 2001
From: Niko Tyni <[email protected]>
Date: Tue, 29 Jul 2014 23:42:24 +0300
Subject: [PATCH] Fix compatibility with newer Encode versions

As of Encode 2.55 (commit
 https://github.com/dankogai/p5-encode/commit/93b3d593d85004c570e44f3f79db0ca3c08d89ea
) Encode doesn't inherit from Exporter anymore, so
Encode->export_to_level() fails.

Replace the export_to_level() calls with Import::Into.

Bug: https://rt.cpan.org/Public/Bug/Display.html?id=95975
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=752928
---
 lib/Encode/Arabic.pm                  | 4 +++-
 lib/Encode/Arabic/ArabTeX.pm          | 5 ++++-
 lib/Encode/Arabic/ArabTeX/RE.pm       | 4 +++-
 lib/Encode/Arabic/ArabTeX/Verbatim.pm | 4 +++-
 lib/Encode/Arabic/ArabTeX/ZDMG.pm     | 3 ++-
 lib/Encode/Arabic/ArabTeX/ZDMG/RE.pm  | 4 +++-
 lib/Encode/Arabic/Buckwalter.pm       | 4 +++-
 lib/Encode/Arabic/Parkinson.pm        | 4 +++-
 8 files changed, 24 insertions(+), 8 deletions(-)

diff --git a/lib/Encode/Arabic.pm b/lib/Encode/Arabic.pm
index aeebc36..d434d62 100644
--- a/lib/Encode/Arabic.pm
+++ b/lib/Encode/Arabic.pm
@@ -8,6 +8,7 @@ package Encode::Arabic;
 
 our $VERSION = '1.9' || do { q $Revision: 808 $ =~ /(\d+)/; sprintf "%4.2f", $1 / 100 };
 
+use Import::Into;
 
 sub import {            # perform import as if Encode were used one level before this module
 
@@ -25,7 +26,8 @@ sub import {            # perform import as if Encode were used one level before
 
     require Encode;
 
-    Encode->export_to_level(1, @_);
+    shift @_; # no need for the package name
+    Encode->import::into(1, @_);
 }
 
 
diff --git a/lib/Encode/Arabic/ArabTeX.pm b/lib/Encode/Arabic/ArabTeX.pm
index ffe43c2..ca54414 100644
--- a/lib/Encode/Arabic/ArabTeX.pm
+++ b/lib/Encode/Arabic/ArabTeX.pm
@@ -14,6 +14,8 @@ use warnings;
 use Scalar::Util 'blessed';
 use Carp;
 
+use Import::Into;
+
 our $VERSION = do { q $Revision: 717 $ =~ /(\d+)/; sprintf "%4.2f", $1 / 100 };
 
 
@@ -107,7 +109,8 @@ sub import {            # perform import as if Encode were used one level before
 
     require Encode;
 
-    Encode->export_to_level(1, @_);     # here comes the only trick ^^
+    shift @_; # no need for the package name
+    Encode->import::into(1, @_);     # here comes the only trick ^^
 }
 
 
diff --git a/lib/Encode/Arabic/ArabTeX/RE.pm b/lib/Encode/Arabic/ArabTeX/RE.pm
index 1d645b5..7b851ef 100644
--- a/lib/Encode/Arabic/ArabTeX/RE.pm
+++ b/lib/Encode/Arabic/ArabTeX/RE.pm
@@ -12,6 +12,7 @@ use strict;
 use warnings;
 
 use Scalar::Util 'blessed';
+use Import::Into;
 
 our $VERSION = do { q $Revision: 162 $ =~ /(\d+)/; sprintf "%4.2f", $1 / 100 };
 
@@ -49,7 +50,8 @@ our %modemap = (
 
 sub import {            # perform import as if Encode were used one level before this module
     require Encode;
-    Encode->export_to_level(1, @_);
+    shift @_; # no need for the package name
+    Encode->import::into(1, @_);
 }
 
 
diff --git a/lib/Encode/Arabic/ArabTeX/Verbatim.pm b/lib/Encode/Arabic/ArabTeX/Verbatim.pm
index 0d09f78..7fd36eb 100644
--- a/lib/Encode/Arabic/ArabTeX/Verbatim.pm
+++ b/lib/Encode/Arabic/ArabTeX/Verbatim.pm
@@ -18,6 +18,7 @@ our $VERSION = do { q $Revision: 717 $ =~ /(\d+)/; sprintf "%4.2f", $1 / 100 };
 
 use Encode::Arabic::ArabTeX ();
 use base 'Encode::Arabic::ArabTeX';
+use Import::Into;
 
 
 use Encode::Encoding;
@@ -110,7 +111,8 @@ sub import {            # perform import as if Encode were used one level before
 
     require Encode;
 
-    Encode->export_to_level(1, @_);     # here comes the only trick ^^
+    shift @_; # no need for the package name
+    Encode->import::into(1, @_);     # here comes the only trick ^^
 }
 
 
diff --git a/lib/Encode/Arabic/ArabTeX/ZDMG.pm b/lib/Encode/Arabic/ArabTeX/ZDMG.pm
index 83a8384..694b615 100644
--- a/lib/Encode/Arabic/ArabTeX/ZDMG.pm
+++ b/lib/Encode/Arabic/ArabTeX/ZDMG.pm
@@ -79,7 +79,8 @@ sub import {            # perform import as if Encode were used one level before
 
     require Encode;
 
-    Encode->export_to_level(1, @_);     # here comes the only trick ^^
+    shift @_; # no need for the package name
+    Encode->import::into(1, @_);     # here comes the only trick ^^
 }
 
 
diff --git a/lib/Encode/Arabic/ArabTeX/ZDMG/RE.pm b/lib/Encode/Arabic/ArabTeX/ZDMG/RE.pm
index 1a2b8f6..5b3668c 100644
--- a/lib/Encode/Arabic/ArabTeX/ZDMG/RE.pm
+++ b/lib/Encode/Arabic/ArabTeX/ZDMG/RE.pm
@@ -10,13 +10,15 @@ use 5.008;
 
 use strict;
 use warnings;
+use Import::Into;
 
 our $VERSION = do { q $Revision: 143 $ =~ /(\d+)/; sprintf "%4.2f", $1 / 100 };
 
 
 sub import {            # perform import as if Encode were used one level before this module
     require Encode;
-    Encode->export_to_level(1, @_);
+    shift @_; # no need for the package name
+    Encode->import::into(1, @_);
 }
 
 
diff --git a/lib/Encode/Arabic/Buckwalter.pm b/lib/Encode/Arabic/Buckwalter.pm
index c8a3501..6d7ae92 100644
--- a/lib/Encode/Arabic/Buckwalter.pm
+++ b/lib/Encode/Arabic/Buckwalter.pm
@@ -12,6 +12,7 @@ use strict;
 use warnings;
 
 use Scalar::Util 'blessed';
+use Import::Into;
 
 our $VERSION = do { q $Revision: 179 $ =~ /(\d+)/; sprintf "%4.2f", $1 / 100 };
 
@@ -66,7 +67,8 @@ sub import {            # perform import as if Encode were used one level before
 
     require Encode;
 
-    Encode->export_to_level(1, @_);
+    shift @_; # no need for the package name
+    Encode->import::into(1, @_);
 }
 
 
diff --git a/lib/Encode/Arabic/Parkinson.pm b/lib/Encode/Arabic/Parkinson.pm
index 39f0ff6..36651f5 100644
--- a/lib/Encode/Arabic/Parkinson.pm
+++ b/lib/Encode/Arabic/Parkinson.pm
@@ -12,6 +12,7 @@ use strict;
 use warnings;
 
 use Scalar::Util 'blessed';
+use Import::Into;
 
 our $VERSION = do { q $Revision: 179 $ =~ /(\d+)/; sprintf "%4.2f", $1 / 100 };
 
@@ -66,7 +67,8 @@ sub import {            # perform import as if Encode were used one level before
 
     require Encode;
 
-    Encode->export_to_level(1, @_);
+    shift @_; # no need for the package name
+    Encode->import::into(1, @_);
 }
 
 
-- 
2.0.1

Reply via email to