Package: liblocale-maketext-lexicon-perl
Version: 0.61-1
Tags: patch
Hi Stephen,
the test for ignoring nonexisting files in lexicon_get_() added in
upstream 0.49 is broken. Currently lexicon_get_() exits with
defined $src or die 'next';
but since there's no trailing newline, perl appends the location of the error
into $@ ("next at /usr/share/perl5/Locale/Maketext/Lexicon.pm line 473.")
This is tested in import() as
next if $@ and $@ eq 'next';
which never matches.
I'm attaching a testcase that fails for me with
Can't call method "maketext" on an undefined value at t.pl line 17.
since the import() dies on parsing 'nonexistent.po' and never gets as
far as 'se.po'. (Obviously it needs a working 'fi.po' and 'se.po', but
I'm leaving those out as they are trivial.)
Proposed patch attached as well.
(This is related to #304452 against request-tracker3.4.)
Cheers,
--
Niko Tyni [EMAIL PROTECTED]
#!/usr/bin/perl -w
use strict;
package Hello::I18N;
use base 'Locale::Maketext';
use Locale::Maketext::Lexicon {
fi => [
Gettext => 'fi.po',
Gettext => 'nonexistent.po'
],
se => [
Gettext => 'se.po',
],
};
print Hello::I18N->new->get_handle('se')->maketext("Hello, world!"), "\n";
--- lib/Locale/Maketext/Lexicon.pm 2006/06/08 11:49:51 1.1
+++ lib/Locale/Maketext/Lexicon.pm 2006/06/08 11:50:09
@@ -289,6 +289,7 @@
my @content = eval {
$class->lexicon_get($src, scalar caller, $lang);
};
+ chomp $@;
next if $@ and $@ eq 'next';
die $@ if $@;
@@ -468,7 +469,7 @@
map { File::Spec->catfile($_, @subpath, $src) } @INC;
} -1 .. $#path)[-1] unless -e $src;
- defined $src or die 'next';
+ defined $src or die "next\n";
$fh->open($src) or die "Cannot read $src (called by $caller): $!";
binmode($fh);