at master 2.2 kB view raw
1From http://daveviner.blogspot.com/2009/12/amazon-mechanical-turk-perl-library.html 2http://www.vinertech.com/patches/net-amazon-mechanicalturk.patch 3 4diff -rubB Net-Amazon-MechanicalTurk-1.01/lib/Net/Amazon/MechanicalTurk/ModuleUtil.pm Net-Amazon-MechanicalTurk-1.01/lib/Net/Amazon/MechanicalTurk/ModuleUtil.pm 5--- Net-Amazon-MechanicalTurk-1.01/lib/Net/Amazon/MechanicalTurk/ModuleUtil.pm 2007-08-13 11:38:53.000000000 -0700 6+++ Net-Amazon-MechanicalTurk-1.01/lib/Net/Amazon/MechanicalTurk/ModuleUtil.pm 2009-12-13 16:37:49.000000000 -0800 7@@ -29,17 +29,21 @@ 8 } 9 10 sub packageExists { 11- my ($class, $package) = @_; 12+ my ($class, $package, $moduleFile) = @_; 13+ 14+ if (defined($moduleFile) && exists($INC{$moduleFile})) { 15+ return 1; 16+ } 17 # Symbol table black magic 18 no strict 'refs'; 19- return defined %{*{"${package}::"}}; 20+ return scalar(keys(%{*{"${package}::"}})); 21 } 22 23 sub require { 24 my ($class, $module) = @_; 25- if (!$class->packageExists($module)) { 26 my $moduleFile = $module . ".pm"; 27 $moduleFile =~ s/::/\//g; 28+ if (!$class->packageExists($module, $moduleFile)) { 29 require $moduleFile; 30 } 31 } 32diff -rubB Net-Amazon-MechanicalTurk-1.01/t/73-datagenerator-dbi.t Net-Amazon-MechanicalTurk-1.01/t/73-datagenerator-dbi.t 33--- Net-Amazon-MechanicalTurk-1.01/t/73-datagenerator-dbi.t 2007-08-13 11:38:56.000000000 -0700 34+++ Net-Amazon-MechanicalTurk-1.01/t/73-datagenerator-dbi.t 2009-12-13 16:55:30.000000000 -0800 35@@ -8,10 +8,10 @@ 36 37 eval { 38 require DBI; 39- require DBD::SQLite2; 40+ require DBD::SQLite; 41 }; 42 if ($@) { 43- plan skip_all => "SQLite2 not installed."; 44+ plan skip_all => "SQLite not installed."; 45 } 46 else { 47 plan tests => 2; 48@@ -21,7 +21,7 @@ 49 #----------------------- 50 my $dbfile = "t/data/test.db"; 51 unlink($dbfile) if (-f $dbfile); 52-my $dbh = DBI->connect("dbi:SQLite2:dbname=${dbfile}","","", { 53+my $dbh = DBI->connect("dbi:SQLite:dbname=${dbfile}","","", { 54 RaiseError => 1, 55 AutoCommit => 1 56 }); 57@@ -42,7 +42,7 @@ 58 foreach my $id (1..30) { 59 $sth->execute($id, rand(), scalar localtime()); 60 } 61- 62+$sth->finish(); 63 64 # Actual test 65 #----------------------