title: DBI and fork don't work on Windows
body: <p>I used this article: <a href="http://www.perlmonks.org/?node_id=594175" rel="nofollow">http://www.perlmonks.org/?node_id=594175</a> to write code, combining DBI with fork. It works on Linux, but doesn't work on Windows XP. I am using Active state Perl v5.10.0 MSWin32-x86-multi-thread, DBD::mysql v4.011.</p>
  
  <p>On Linux Perl v5.16.1 i486-linux-thread-multi DBD::mysql v4.021.</p>
  
  <p>Code. dbi_fork.pl:</p>
  
  <pre><code>#!/usr/bin/perl
  
  use strict;
  use warnings;
  use DBI;
  require "mysql.pl";
  
  my $dbh = connect_mysql();
  
  if (fork()) {
      $dbh-&gt;do("UPDATE articles SET title='parent' WHERE id=1");
  }
  else {
      my $dbh_child = $dbh-&gt;clone();
      $dbh-&gt;{InactiveDestroy} = 1;
      undef $dbh;
      $dbh_child-&gt;do("UPDATE articles SET title='child' WHERE id=2");
  }
  </code></pre>
  
  <p>mysql.pl:</p>
  
  <pre><code>sub connect_mysql
  {
      my $user_db = 'user';
      my $password_db = 'secret';
      my $base_name = 'test';
      my $mysql_host_url = 'localhost';
  
      my $dsn = "DBI:mysql:$base_name:$mysql_host_url";
      my $dbh = DBI-&gt;connect($dsn, $user_db, $password_db) or die $DBI::errstr;
  
      return $dbh;
  }
  
  1;
  </code></pre>
  
  <p>articles table:</p>
  
  <pre><code>DROP TABLE IF EXISTS `articles`;
  CREATE TABLE `articles` (
    `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
    `title` varchar(50) DEFAULT NULL,
    PRIMARY KEY (`id`)
  ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
  
  -- ----------------------------
  -- Records of articles
  -- ----------------------------
  INSERT INTO `articles` VALUES ('1', 'title1');
  INSERT INTO `articles` VALUES ('2', 'title2');
  </code></pre>
  
  <p>On Windows it gives an error:</p>
  
  <pre><code>$ perl ./dbi_fork.pl
  DBD::mysql::db clone failed: handle 2 is owned by thread 2344b4 not current
  thread 1a45014 (handles can't be shared between threads and your driver may
  need a CLONE method added) at ./dbi_fork.pl line 14.
  </code></pre>
  
  <p>How to fix?</p>