Subject: | Issue with Makefile.PL and paramter strings including "=" signs |
Date: | Tue, 3 May 2011 11:18:47 +0100 |
To: | <bug-Template-Toolkit [...] rt.cpan.org> |
From: | "Roger Lucas" <Roger.Lucas [...] ubiquisys.com> |
Dear Template-Toolkit developers,
When installing Template-Toolkit v2.22 on my x86-64 system running
Centos 5, the default "OPTIMIZE" parameter for the compiler is "-O2 -g
-m64 -mtune=generic". Unfortunately, the Makefile.PL parameter parsing
code uses "split(/=/)" to separate the parameter name from the parameter
value. This code fails to correctly parse the parameter and you get a
Makefile with:
# OPTIMIZE => q[-O2 -g -m64 -mtune]
rather than
# OPTIMIZE => q[-O2 -g -m64 -mtune=generic]
This in turn causes the compiler to throw an error as "-mtune" requires
a parameter.
A simple fix would be to change the "split(=/)" command for a regex
match. A patch with this code change is:
--- Template-Toolkit-2.22.orig/Makefile.PL 2009-05-21
13:16:48.000000000 +0100
+++ Template-Toolkit-2.22/Makefile.PL 2011-04-29 10:09:16.000000000
+0100
@@ -43,7 +43,7 @@
my (%config, %ttconfig);
while ($_ = shift) {
- my ($k, $v) = split(/=/);
+ my ($k, $v) = ($_ =~ /^([^=]+)=(.*)/);
if ($k =~ /^TT/) {
$ttconfig{ $k } = $v || 0;
}
Thanks and best regards,
Roger Lucas