From: Rob Kinyon Date: Wed, 6 Jan 2010 03:26:54 +0000 (-0500) Subject: (RT #48031) Better var localizations (Thanks, SPROUT!) X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=dbsrgits%2FDBM-Deep.git;a=commitdiff_plain;h=4ae410a700e22245143f60d19c3e2e25a1547b9d (RT #48031) Better var localizations (Thanks, SPROUT!) --- diff --git a/Changes b/Changes index 72340c4..49ffe4d 100644 --- a/Changes +++ b/Changes @@ -17,6 +17,7 @@ Revision history for DBM::Deep. machine) now takes ( N / 40 ) ** (1.66) seconds. So, clearing 4000 keys (as is the test in t/03_bighash.t) would take ~2070 seconds. - (RT #40782) Fixed bug when handling a key of '0' (Thanks Sterling!) + - (RT #48031) Fixed bug with localized $, (Thanks, SPROUT!) 1.0019_001 Dec 31 22:00:00 2009 EST (This is the first developer release for 1.0020.) diff --git a/MANIFEST b/MANIFEST index 57ed8f3..c9d020d 100644 --- a/MANIFEST +++ b/MANIFEST @@ -82,6 +82,7 @@ t/48_autoexport_after_delete.t t/50_deletes.t t/52_memory_leak.t t/53_misc_transactions.t +t/54_output_punct_vars.t t/97_dump_file.t t/98_pod.t t/99_pod_coverage.t diff --git a/lib/DBM/Deep/Storage/File.pm b/lib/DBM/Deep/Storage/File.pm index c2a7c7e..b3075e1 100644 --- a/lib/DBM/Deep/Storage/File.pm +++ b/lib/DBM/Deep/Storage/File.pm @@ -180,7 +180,7 @@ sub print_at { my $self = shift; my $loc = shift; - local ($/,$\); + local ($,,$\); my $fh = $self->{fh}; if ( defined $loc ) { @@ -214,8 +214,6 @@ sub read_at { my $self = shift; my ($loc, $size) = @_; - local ($/,$\); - my $fh = $self->{fh}; if ( defined $loc ) { seek( $fh, $loc + $self->{file_offset}, SEEK_SET ); diff --git a/t/54_output_punct_vars.t b/t/54_output_punct_vars.t new file mode 100644 index 0000000..cc2e2e9 --- /dev/null +++ b/t/54_output_punct_vars.t @@ -0,0 +1,29 @@ +use strict; +use warnings FATAL => 'all'; + +use Test::More; +use t::common qw( new_fh ); + +use_ok( 'DBM::Deep' ); + +my ($fh, $filename) = new_fh(); +ok eval { + local $,="\t"; + my $db = DBM::Deep->new( file => $filename, fh => $fh, ); + $db->{34808} = "BVA/DIVISO"; + $db->{34887} = "PRIMARYVEN"; +}, '$, causes no hiccoughs or 150MB files'; + + +($fh, $filename) = new_fh(); +ok eval { + local $\="\n"; + my $db = DBM::Deep->new( file => $filename, fh => $fh, ); + $db->{foo} = ""; + $db->{baz} = "11111"; + $db->{foo} + = "counterpneumonoultramicroscopicsilicovolcanoconiotically"; + $db->{baz}; +}, '$\ causes no problems'; + +done_testing;