From 54f56dad9d4e080e2c22d6cd1f7774daa95b493e Mon Sep 17 00:00:00 2001 From: Alex Schroeder Date: Sun, 29 Mar 2015 23:31:13 +0200 Subject: [PATCH] simple-rules.pl uses strict Variables which are essentially global and which contain state are localized before they are set. In order to localize them, they have to be declared here using vars, first. --- modules/simple-rules.pl | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/simple-rules.pl b/modules/simple-rules.pl index 7c53e2e7..a981b363 100644 --- a/modules/simple-rules.pl +++ b/modules/simple-rules.pl @@ -16,7 +16,7 @@ # 59 Temple Place, Suite 330 # Boston, MA 02111-1307 USA -#use strict; #TODO local variables? What? +use strict; AddModuleDescription('simple-rules.pl', 'Simple Fast Alternate Text Formatting Rules'); use vars qw($q $OpenPageName $FS $UrlPattern $FreeLinkPattern); @@ -26,6 +26,10 @@ use vars qw($q $OpenPageName $FS $UrlPattern $FreeLinkPattern); my $PROT = "\x1c"; my $DIRT = "\x1d"; +# Variables which are essentially global and which contain state are localized before they are set. In order to localize +# them, they have to be declared here, first. +use vars qw($counter %protected %dirty); + sub NewSimpleRulesApplyRules { # locallinks: apply rules that create links depending on local config (incl. interlink!) my ($text, $locallinks, $withanchors, $revision) = @_; @@ -120,7 +124,7 @@ sub SimpleRulesMungeResult { my @flags; my $count = 0; my $html; - foreach $item (split(/$DIRT([0-9]+)$DIRT/, $raw)) { + foreach my $item (split(/$DIRT([0-9]+)$DIRT/, $raw)) { if ($count % 2) { # deal with reference if ($dirty{$item}) { # dirty block if ($html) {