Subject: | Makefile.PL: fix the semantics of the --chained option |
Currently you can call
- Makefile.PL --chained
- Makefile.PL --chained 1
- Makefile.PL --chained y
All are accepted but surprisingly, only the last option results in the chained being set to true.
The patch below fixes it to make --chained a binary/negatable option (so you can pass --chained or --nochained). Also, the prompt is only printed if this option was omitted.
--- c:\temp\p4v\PRGDWM355382_qaperforce_1666\depot\QA\Toolbox\main.br\CPAN\DBD-Sybase\1.15\src\Makefile#3.PL 2014-01-15 14:00:08.000000000 +-0100
+++ c:\temp\p4v\PRGDWM355382_qaperforce_1666\depot\QA\Toolbox\main.br\CPAN\DBD-Sybase\1.15\src\Makefile@=9267234.PL 2014-01-15 14:00:08.000000000 +-0100
@@ -23,13 +23,13 @@
my $file;
my $chained;
my $threaded_libs;
my $accept_test_defaults;
GetOptions(
'--file' => \$file,
- '--chained:s' => \$chained,
+ '--chained!' => \$chained,
'--threaded_libs:s' => \$threaded_libs,
'--accept_test_defaults' => \$accept_test_defaults
);
select(STDOUT);
$| = 1;
@@ -30,36 +30,37 @@
'--threaded_libs:s' => \$threaded_libs,
'--accept_test_defaults' => \$accept_test_defaults
);
select(STDOUT);
$| = 1;
print OUT "$_=$pwd{$_}\n";
}
close(OUT);
}
sub checkChainedAutoCommit {
- print <<EOF;
+ my $ans;
+ if ( defined($chained) ) {
+ $ans = $chained ? 'y' : 'n';
+ }
+ else {
+ print <<EOF;
By default DBD::Sybase 1.05 and later use the 'CHAINED' mode (where available)
when 'AutoCommit' is turned off. Versions 1.04 and older instead managed
the transactions explicitly with a 'BEGIN TRAN' before the first DML
statement. Using the 'CHAINED' mode is preferable as it is the way that
Sybase implements AutoCommit handling for both its ODBC and JDBC drivers.
EOF
- print "Use 'CHAINED' mode by default (Y/N) [Y]: ";
- my $ans;
- if ( defined($chained) ) {
- $ans = $chained;
- }
- else {
+ print "Use 'CHAINED' mode by default (Y/N) [Y]: ";
$ans = getAns(0);
}
if ( $ans and $ans !~ /^y/i ) {
+ print "Avoiding 'CHAINED' mode.\n";
$inc_string .= " -DNO_CHAINED_TRAN=1";
}
print "\n";
}
sub checkForThreadedLibs {