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?a=commitdiff_plain;h=f696d6ab063b58bdc1887960494873aa201b4ef6;p=dbsrgits%2FDBM-Deep.git (RT #48031) Better var localizations (Thanks, SPROUT!) --- diff --git a/Changes b/Changes index 03f8c34..57578f3 100644 --- a/Changes +++ b/Changes @@ -4,6 +4,7 @@ Revision history for DBM::Deep. - (This version is compatible with 1.0014) - Fix deep recursion errors (RT#53575) - Avoid leaving temp files lying around (RT#32462) + - (RT #48031) Fixed bug with localized $, (Thanks, SPROUT!) 1.0014 Jun 13 23:15:00 2008 EST - (This version is compatible with 1.0013) diff --git a/MANIFEST b/MANIFEST index 02e437f..fe83126 100644 --- a/MANIFEST +++ b/MANIFEST @@ -72,6 +72,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/File.pm b/lib/DBM/Deep/File.pm index ba4d04f..2527d6a 100644 --- a/lib/DBM/Deep/File.pm +++ b/lib/DBM/Deep/File.pm @@ -177,7 +177,7 @@ sub print_at { my $self = shift; my $loc = shift; - local ($/,$\); + local ($,,$\); my $fh = $self->{fh}; if ( defined $loc ) { @@ -211,8 +211,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;