From 0e079eba45bcb834792660358b2e86dcb70e494e Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Tue, 12 Jan 2010 10:47:30 +0100 Subject: [PATCH] Endlose Rekursionen via call_sub vermeiden. --- bin/mozilla/common.pl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bin/mozilla/common.pl b/bin/mozilla/common.pl index defa5f1b0..c8ab34033 100644 --- a/bin/mozilla/common.pl +++ b/bin/mozilla/common.pl @@ -9,6 +9,7 @@ # ###################################################################### +use Carp; use SL::Common; use SL::DBUtils; use SL::Form; @@ -508,6 +509,8 @@ sub show_history { # ------------------------------------------------------------------------- +my %_called_subs = (); + sub call_sub { $main::lxdebug->enter_sub(); @@ -526,6 +529,9 @@ sub call_sub { $form->error(sprintf($locale->text("Attempt to call an undefined sub named '%s'"), $name)); } + $_called_subs{$name}++; + confess "RECURSION DETECTION: call_sub($name) called " . $_called_subs{$name} . " time(s)" if $_called_subs{$name} > 10; + { no strict "refs"; &{ $name }(@_); -- 2.20.1