summaryrefslogtreecommitdiff
path: root/lib/Tie
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>2003-05-13 13:08:47 +0000
committerGurusamy Sarathy <gsar@cpan.org>2003-05-13 13:08:47 +0000
commite0cf91d56b571fae04d6e52c0045b5e6dc4f5eae (patch)
tree7f22a7728fcb385dc24472abfc93bd5756515eca /lib/Tie
parent7e0017d3b6ac1a9bfee873d050999f77952fb701 (diff)
downloadperl-e0cf91d56b571fae04d6e52c0045b5e6dc4f5eae.tar.gz
the \do {local *FH} trick in Tie::File was really only needed
on 5.005 and earlier, since later versions can autovivify the handle however, a search in the p5p archives reveals the trick doesn't fully work in the versions it is needed in, so use the more standard Symbol::gensym() way p4raw-id: //depot/perl@19511
Diffstat (limited to 'lib/Tie')
-rw-r--r--lib/Tie/File.pm14
-rw-r--r--lib/Tie/File/t/09_gen_rs.t7
2 files changed, 5 insertions, 16 deletions
diff --git a/lib/Tie/File.pm b/lib/Tie/File.pm
index 90be50f68c..c1f3be347d 100644
--- a/lib/Tie/File.pm
+++ b/lib/Tie/File.pm
@@ -94,7 +94,11 @@ sub TIEARRAY {
} elsif (ref $file) {
croak "usage: tie \@array, $pack, filename, [option => value]...";
} else {
- $fh = \do { local *FH }; # only works in 5.005 and later
+ if ($] < 5.006) {
+ # perl 5.005 and earlier don't autovivify filehandles
+ require Symbol;
+ $fh = Symbol::gensym();
+ }
sysopen $fh, $file, $opts{mode}, 0666 or return;
binmode $fh;
++$opts{ourfh};
@@ -411,14 +415,6 @@ sub DESTROY {
if ($self->{fh} and $self->{ourfh}) {
delete $self->{ourfh};
close delete $self->{fh};
- # The above close() causes a problem which would tickle a bug in
- # 09_gen_rs.t subtest #51 and onwards but only with threaded builds:
- # Couldn't seek filehandle: Bad file number at lib/Tie/File.pm line 826
- # Tie::File::_seek('Tie::File=HASH(0x14015e2f0)',-1) called at lib/Tie/File.pm line 870
- # Tie::File::_fill_offsets('Tie::File=HASH(0x14015e2f0)') called at lib/Tie/File.pm line 256
- # Tie::File::FETCHSIZE('Tie::File=HASH(0x14015e2f0)') called at lib/Tie/File.pm line 428
- # Tie::File::_splice('Tie::File=HASH(0x14015e2f0)',1,0,'x','y') called at lib/Tie/File.pm line 403
- # Tie::File::SPLICE('Tie::File=HASH(0x14015e2f0)',1,0,'x','y') called at lib/Tie/File/t/09_gen_rs.t line 120
}
}
diff --git a/lib/Tie/File/t/09_gen_rs.t b/lib/Tie/File/t/09_gen_rs.t
index 1b02a84f6d..7d70e3e528 100644
--- a/lib/Tie/File/t/09_gen_rs.t
+++ b/lib/Tie/File/t/09_gen_rs.t
@@ -105,13 +105,6 @@ if (setup_badly_terminated_file(3)) {
push @a, "next";
check_contents($badrec, "next");
}
-use Config;
-if ($Config{usethreads}) {
- for (51..58) {
- print "not ok $_ # TODO - premature close() -> _seek() failure\n";
- }
- exit 0;
-}
# (51-52)
if (setup_badly_terminated_file(2)) {
$o = tie @a, 'Tie::File', $file,