Package: po4a
Version: 0.32-1

Hi,
while building the latest devscripts package with perl 5.10 from experimental

$ po4a --rm-translations --no-backups devscripts-po4a.conf

fails with

Can't use string ("0") as a HASH ref while "strict refs" in use at
/usr/bin/po4a line 504, <CONFIG> line 6.

po4a uses pathetic constructs like ${%$hashref}{key} when $hashref->{key}
was called for.  The former used to worked in perl 5.8 and earlier, but
is apparently interpreted differently in perl 5.10. The first patch below
fixes all such incantations in po4a.
Note that the line marked with XXX looks suspicious to me: the
commentss imply that one hash is to be merged into another,
but the operation  %a = %b really overwrites hash a with (a copy of) hash b.

The above command also prints lots of warnings like

Constant subroutine Locale::Po4a::Common::LC_CTYPE redefined at
/usr/share/perl/5.10/Exporter.pm line 66.
 at /usr/share/perl5/Locale/Po4a/Common.pm line 194
Prototype mismatch: sub Locale::Po4a::Common::LC_CTYPE () vs none at
/usr/share/perl/5.10/Exporter.pm line 66.
 at /usr/share/perl5/Locale/Po4a/Common.pm line 194

The second patch below gets rid of these, but I suspect the real culprit
is Locale::gettext (liblocal-gettext-perl) because it also implements
(and exports)
the constants LC_*. These are also in POSIX.pm (Perl core module).

Cheers, Roderich
--- po4a-0.32-ORIG/po4a	2008-01-06 16:00:14.000000000 +0100
+++ po4a-0.32/po4a	2008-01-06 16:08:19.000000000 +0100
@@ -440,10 +440,10 @@
     $opts{"msgmerge-opt"} .= " --previous" if $previous;
 
     # options to transmit to the modules
-    %{$opts{"options"}} = (
+    $opts{"options"} = {
         "verbose" => $opts{"verbose"},
         "debug"   => $opts{"debug"}
-    );
+    };
     foreach (@options) {
         if (m/^([^=]*)=(.*)$/) {
             $opts{"options"}{$1}="$2";
@@ -498,10 +498,10 @@
             if (! defined $lang) {
                 $lang = "global";
             }
-            if (! defined ${%$options}{$lang}) {
-                ${%$options}{$lang} = $opt;
+            if (! defined $options->{$lang}) {
+                $options->{$lang} = $opt;
             } else {
-                ${%$options}{$lang} .= " $opt";
+                $options->{$lang} .= " $opt";
             }
         } else {
             last;
@@ -638,20 +638,20 @@
 	my %options;
 	# 1. Use the global options ([opt] ...)
 	%options = %{$document{''}{'options'}}
-	  if defined %{$document{''}{'options'}};
+	  if defined $document{''}{'options'};
 
 	# 2. Merge the alias options
 	if (defined $aliases{$1}) {
 	    $document{$main}{'format'} = $aliases{$1}{"module"};
-	    if (defined %{$aliases{$1}{"options"}}) {
-		%options = %{$aliases{$1}{"options"}};
+	    if (defined $aliases{$1}{"options"}) {
+		%options = %{$aliases{$1}{"options"}}; # XXX not a merge, but overwrite
 	    }
 	}
 
 	# 3. If this file was already specified, reuse the previous
 	#    options (no merge)
 	%options = %{$document{$main}{'options'}}
-	  if defined %{$document{$main}{'options'}};
+	  if defined $document{$main}{'options'};
 
 	# 4. Merge the document specific options
 	# separate the end of the line, which contains options.
@@ -697,7 +697,7 @@
 	$o =~ s/.*?\[options\] +//;
 	parse_config_options("$config_file:$nb",
 	                     $o,
-	                     \%{$document{''}{"options"}});
+	                     $document{''}{"options"});
     } else {
 	die wrap_ref_mod("$config_file:$nb", "",
 	    gettext("Unparsable command '%s'."), $cmd);

--- po4a-0.32-ORIG/lib/Locale/Po4a/Common.pm	2008-01-06 16:00:14.000000000 +0100
+++ po4a-0.32/lib/Locale/Po4a/Common.pm	2008-01-06 16:09:59.000000000 +0100
@@ -192,8 +192,8 @@
 BEGIN {
     if (eval { require Locale::gettext }) {
        import Locale::gettext;
-       use POSIX;
-       setlocale(LC_MESSAGES, '');
+       require POSIX;
+       POSIX::setlocale(&POSIX::LC_MESSAGES, '');
     } else {
        eval '
            sub bindtextdomain($$) { }

Reply via email to