Subject: | Patch to add _ONESIDED behavior |
In my Locale::Maketext::Utils module I have the concept of a "Onesided" lexicon.
It is described here:
http://search.cpan.org/~dmuey/Locale-Maketext-Utils-
0.0.12/lib/Locale/Maketext/Utils.pm#our_$Onesided
Would it make more sense if it was implemented in MakeText's maketext() method directly?
(even as an _AUTO type lexicon key (e.g _ONESIDED) instead of a global var)
Note: Version 0.13 of L::M::Utils will handle it in the overridden maketext method in L::M::Utils
so as to better support dynamic-lookup-as-needed tied lexicons
Subject: | _ONESIDED.patch |
--- Maketext.pm.orig 2009-05-13 15:39:57.000000000 -0500
+++ Maketext.pm 2009-05-13 15:42:24.000000000 -0500
@@ -193,6 +193,10 @@
if(exists $h_r->{$phrase}) {
DEBUG and warn " Found \"$phrase\" in $h_r\n";
unless(ref($value = $h_r->{$phrase})) {
+ if ($h_r->{'_ONESIDED'} && (!defined $h_r->{$phrase} || $h_r->{$phrase} eq '')) {
+ $value = $phrase;
+ }
+
# Nonref means it's not yet compiled. Compile and replace.
$value = $h_r->{$phrase} = $handle->_compile($value);
}