Subject: | $value Not Set After Second Call to failure_handler_auto() |
Dear Andy Lester,
Hi. This is imacat from Taiwan. I'm the author of
Locale::Maketext::Gettext. I was reading bug#33938. I found that
failure_handler_auto() still won't work after applying this patch while
I was trying to apply this patch on Locale::Maketext and incorporate it
into my own Locale::Maketext::Gettext. At this line:
$lex->{$phrase} ||= ($value = $handle->_compile($phrase));
After second call with a same $phrase, $lex->{$phrase} has a true
value so that the following parts will not be run, resulting $value not
get set at all.
A simple test showing this is attached below. I also attached a
simple patch that should fix this. Hope that this helps. Please tell
me if there is any problem. Thank you.
======
imacat@rinse /tmp % tar xzf Locale-Maketext-1.10.tar.gz
imacat@rinse /tmp % cd Locale-Maketext-1.10/lib/Locale
imacat@rinse lib/Locale % patch < /tmp/bug33938.patch
patching file Maketext.pm
Hunk #1 succeeded at 127 (offset 1 line).
Hunk #2 succeeded at 135 (offset 1 line).
Hunk #3 succeeded at 177 (offset 1 line).
imacat@rinse lib/Locale % cat /tmp/test.pl
#! /usr/bin/perl -w
use strict;
use lib qw(/tmp/Locale-Maketext-1.10/lib);
my $lh = TL10N->get_handle("en");
$lh->fail_with('failure_handler_auto');
print $lh->maketext("abcd") . "\n";
print $lh->maketext("abcd") . "\n";
package TL10N;
use base qw(Locale::Maketext);
package TL10N::en;
use base qw(Locale::Maketext);
imacat@rinse lib/Locale % /tmp/test.pl
abcd
Use of uninitialized value in concatenation (.) or string at
/tmp/test.pl line 7.
imacat@rinse lib/Locale %
=======
Subject: | Locale-Maketext-1.10-2ndvalue.diff.asc |
Message body not shown because it is not plain text.