From f5f077a7993b74d793005e3aea6664debef07853 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Mon, 1 Feb 2010 14:54:54 +0100 Subject: [PATCH] =?utf8?q?Funktionsnamensaufl=C3=B6sung=20gefixt?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Hintergrund. "my $abc = ... if ..." bewirkt, dass zuerst das "if" ausgeführt wird. Schlägt das "if" fehl, so wird die Zuweisung nicht ausgeführt. Somit bleibt der Wert in $abc vom vorherigen Aufruf derselben Funktion erhalten. I hate Perl. --- SL/Locale.pm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/SL/Locale.pm b/SL/Locale.pm index 28b13c696..9e74902ca 100644 --- a/SL/Locale.pm +++ b/SL/Locale.pm @@ -239,8 +239,9 @@ sub findsub { } } - my $sub_name = first { defined &{ "::$_" } } @{ $self->{texts_reverse}->{$text_rev} } if $self->{texts_reverse}->{$text_rev}; - $sub_name ||= $text_rev if ($text_rev =~ m/^[a-z][a-z0-9_]+$/) && defined &{ "::$text_rev" }; + my $sub_name; + $sub_name = first { defined(&{ "::${_}" }) } @{ $self->{texts_reverse}->{$text_rev} } if $self->{texts_reverse}->{$text_rev}; + $sub_name ||= $text_rev if ($text_rev =~ m/^[a-z][a-z0-9_]+$/) && defined &{ "::${text_rev}" }; $main::form->error("$text not defined in locale/$self->{countrycode}/all") if !$sub_name; -- 2.20.1