From: Joey Hess Date: Fri, 29 Aug 2008 22:40:41 +0000 (-0400) Subject: Work around perl $_ scoping nonsense that caused breakage when loading external plugins. X-Git-Tag: 2.63~41 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=75a096d056270d5b20f19a55416436d731654105;p=ikiwiki.git Work around perl $_ scoping nonsense that caused breakage when loading external plugins. --- diff --git a/IkiWiki.pm b/IkiWiki.pm index e4765219e..64ef6585f 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -471,7 +471,9 @@ sub loadplugins () { #{{{ unshift @INC, possibly_foolish_untaint($config{libdir}); } - loadplugin($_) foreach @{$config{default_plugins}}, @{$config{add_plugins}}; + foreach my $plugin (@{$config{default_plugins}}, @{$config{add_plugins}}) { + loadplugin($plugin); + } if ($config{rcs}) { if (exists $IkiWiki::hooks{rcs}) { diff --git a/debian/changelog b/debian/changelog index c6fa4261c..46c40bf5e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,6 +4,8 @@ ikiwiki (2.63) UNRELEASED; urgency=low * Typo. Closes: #497003 * Ignore failure to install files into /etc, in case install is running as non-root. + * Work around perl $_ scoping nonsense that caused breakage when loading + external plugins. -- Joey Hess Thu, 28 Aug 2008 16:08:18 -0400 diff --git a/doc/bugs/methodResponse_in_add__95__plugins.mdwn b/doc/bugs/methodResponse_in_add__95__plugins.mdwn index 64a919cec..8a88f4eda 100644 --- a/doc/bugs/methodResponse_in_add__95__plugins.mdwn +++ b/doc/bugs/methodResponse_in_add__95__plugins.mdwn @@ -14,6 +14,13 @@ **patch comment:** solves the problem on 2.61. as these are the first lines of perl i've knowingly written, i can not explain what exactly was happening there. +> Perl's `$_` handling is the worst wart on it, or possibly any language. +> Here it's an alias to the actual value in the array, and when deep +> in the external plugin load code something resets `$_` to a different +> value, the alias remains and it changes the value at a distance. +> +> Thanks for the excellent problem report, [[fixed|done]]. --[[Joey]] + ------------------------------------------------------------------------------ diff --git a/IkiWiki.pm b/IkiWiki.pm index e476521..d43abd4 100644