summaryrefslogtreecommitdiff
path: root/dist/Tie-File
diff options
context:
space:
mode:
authorCraig A. Berry <craigberry@mac.com>2020-02-12 21:07:07 -0600
committerCraig A. Berry <craigberry@mac.com>2020-02-13 13:53:49 -0600
commit9258297b8309a1921f7c04b987d51e57a2509fc7 (patch)
treeefbfdd39a6e3c8f44bf206bce036b26942b82a37 /dist/Tie-File
parentf23231429264cf7e42bf0d4a4d791918ee5d5683 (diff)
downloadperl-9258297b8309a1921f7c04b987d51e57a2509fc7.tar.gz
Don't reopen open file in Tie-File/t/43_synopsis.t
Move the untie earlier and destroy the object holding the file open. Otherwise the next test fails with "file currently locked by another user" on OS's that open with exclusive locking.
Diffstat (limited to 'dist/Tie-File')
-rw-r--r--dist/Tie-File/t/43_synopsis.t9
1 files changed, 5 insertions, 4 deletions
diff --git a/dist/Tie-File/t/43_synopsis.t b/dist/Tie-File/t/43_synopsis.t
index f7abde1080..56688493ef 100644
--- a/dist/Tie-File/t/43_synopsis.t
+++ b/dist/Tie-File/t/43_synopsis.t
@@ -146,6 +146,11 @@ $desc = "got expected element";
: print "not ok $N - $desc\n";
$N++;
+# Untie the first file
+my $u = untie @array;
+$o = undef; # destroy object holding file open
+# TODO: perldoc -f untie does not specify return value for untie
+
open my $G, "<", $file or die "Unable to open $file for reading: $!";
open my $H, ">", $dupe or die "Unable to open $dupe for writing: $!";
while (my $l = <$G>) {
@@ -155,10 +160,6 @@ while (my $l = <$G>) {
close $H or die "Unable to close $dupe after writing: $!";
close $G or die "Unable to close $file after reading: $!";
-# Untie the first file
-my $u = untie @array;
-# TODO: perldoc -f untie does not specify return value for untie
-
$desc = 'tie to dupe file';
my @dupe;
my $p = tie @dupe, 'Tie::File', $file;