From: rkinyon Date: Fri, 24 Feb 2006 19:29:27 +0000 (+0000) Subject: Fixed array test slowness by preventing Test::Builder's SIG{__DIE__} from being called X-Git-Tag: 0-98~17 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a4e2db58c017258f7605572f1fc4daaee12613b6;p=dbsrgits%2FDBM-Deep.git Fixed array test slowness by preventing Test::Builder's SIG{__DIE__} from being called --- diff --git a/lib/DBM/Deep/Array.pm b/lib/DBM/Deep/Array.pm index c6e9bf7..a11619a 100644 --- a/lib/DBM/Deep/Array.pm +++ b/lib/DBM/Deep/Array.pm @@ -13,7 +13,7 @@ use base 'DBM::Deep'; use Scalar::Util (); sub _get_self { - eval { tied( @{$_[0]} ) } || $_[0] + eval { local $SIG{'__DIE__'}; tied( @{$_[0]} ) } || $_[0] } sub TIEARRAY { diff --git a/lib/DBM/Deep/Hash.pm b/lib/DBM/Deep/Hash.pm index 1f95438..4dc0b22 100644 --- a/lib/DBM/Deep/Hash.pm +++ b/lib/DBM/Deep/Hash.pm @@ -5,7 +5,7 @@ use strict; use base 'DBM::Deep'; sub _get_self { - eval { tied( %{$_[0]} ) } || $_[0] + eval { local $SIG{'__DIE__'}; tied( %{$_[0]} ) } || $_[0] } sub TIEHASH { diff --git a/t/03_bighash.t b/t/03_bighash.t index 6bee85d..3dacd84 100644 --- a/t/03_bighash.t +++ b/t/03_bighash.t @@ -2,10 +2,7 @@ # DBM::Deep Test ## use strict; -use Test::More; - -my $max_keys = 4000; -plan tests => 2; +use Test::More tests => 2; use_ok( 'DBM::Deep' ); @@ -21,6 +18,8 @@ if ($db->error()) { ## # put/get many keys ## +my $max_keys = 4000; + for ( 0 .. $max_keys ) { $db->put( "hello $_" => "there " . $_ * 2 ); } diff --git a/t/05_bigarray.t b/t/05_bigarray.t index c729c8d..afca57f 100644 --- a/t/05_bigarray.t +++ b/t/05_bigarray.t @@ -27,7 +27,7 @@ for ( 0 .. $max_keys ) { my $count = -1; for ( 0 .. $max_keys ) { $count = $_; - unless( $db->get( $_ ) == $_ * 2 ) { + unless ( $db->get( $_ ) == $_ * 2 ) { last; }; }