From 9c76ec9323a2a418a696edf0a4bb9d127ac4cf6a Mon Sep 17 00:00:00 2001 From: Magnus Svensson Date: Wed, 21 Jan 2009 11:17:16 +0100 Subject: [PATCH] Bug#39972 mysql-test-run.pl: Confusing error message under special conditions - Fix problem with for example ./mtr --timer, caused by new version of "Getopt::Long" - Evaluating the "$opt" variable as a string, returns the name of the parameter to be modified instead of "Getopt::Long::Callback" which is the class name --- mysql-test/lib/mtr_cases.pm | 7 +++++-- mysql-test/lib/mtr_report.pm | 11 ++++++----- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/mysql-test/lib/mtr_cases.pm b/mysql-test/lib/mtr_cases.pm index 6579a6e8af0..23a85ef7ecc 100644 --- a/mysql-test/lib/mtr_cases.pm +++ b/mysql-test/lib/mtr_cases.pm @@ -45,10 +45,13 @@ our $reorder= 1; sub collect_option { my ($opt, $value)= @_; + # Evaluate $opt as string to use "Getopt::Long::Callback legacy API" + my $opt_name = "$opt"; + # Convert - to _ in option name - $opt =~ s/-/_/g; + $opt_name =~ s/-/_/g; no strict 'refs'; - ${$opt}= $value; + ${$opt_name}= $value; } use File::Basename; diff --git a/mysql-test/lib/mtr_report.pm b/mysql-test/lib/mtr_report.pm index 3e2ef4e09ef..81304ab58e1 100644 --- a/mysql-test/lib/mtr_report.pm +++ b/mysql-test/lib/mtr_report.pm @@ -44,12 +44,13 @@ our $timer= 1; sub report_option { my ($opt, $value)= @_; - # Convert - to _ in option name - $opt =~ s/-/_/g; - no strict 'refs'; - ${$opt}= $value; + # Evaluate $opt as string to use "Getopt::Long::Callback legacy API" + my $opt_name = "$opt"; - #print $name, " setting $opt to ", (defined $value? $value : "undef") ,"\n"; + # Convert - to _ in option name + $opt_name =~ s/-/_/g; + no strict 'refs'; + ${$opt_name}= $value; } sub _name {