[svn:dbi] r15111 - dbi/trunk

[email protected] Mon, 30 Jan 2012 15:01:24 -0800 (PST)
Newsgroups perl.dbi.changes
Message-ID <[email protected]>
Author: timbo
Date: Mon Jan 30 15:01:24 2012
New Revision: 15111

Modified:
   dbi/trunk/DBI.pm

Log:
polish code in setup_driver (thanks to Merijn Broeren)

Modified: dbi/trunk/DBI.pm
==============================================================================
--- dbi/trunk/DBI.pm	(original)
+++ dbi/trunk/DBI.pm	Mon Jan 30 15:01:24 2012
@@ -826,15 +826,17 @@
 
 sub setup_driver {
     my ($class, $driver_class) = @_;
-    my $type;
-    foreach $type (qw(dr db st)){
-	my $class = $driver_class."::$type";
+    my $h_type;
+    foreach $h_type (qw(dr db st)){
+	my $h_class = $driver_class."::$h_type";
 	no strict 'refs';
-	push @{"${class}::ISA"},     "DBD::_::$type"
-	    unless UNIVERSAL::isa($class, "DBD::_::$type");
-	my $mem_class = "DBD::_mem::$type";
-	push @{"${class}_mem::ISA"}, $mem_class
-	    unless UNIVERSAL::isa("${class}_mem", $mem_class)
+	push @{"${h_class}::ISA"},     "DBD::_::$h_type"
+	    unless UNIVERSAL::isa($h_class, "DBD::_::$h_type");
+	# The _mem class stuff is (IIRC) a crufty hack for global destruction
+	# timing issues in early versions of perl5 and possibly no longer needed.
+	my $mem_class = "DBD::_mem::$h_type";
+	push @{"${h_class}_mem::ISA"}, $mem_class
+	    unless UNIVERSAL::isa("${h_class}_mem", $mem_class)
 	    or $DBI::PurePerl;
     }
 }