in reply to Failed to close file
> Always when I run my tests I get:
probably something related with tests path? Is $pack a full path or a relative one? Is a temp dir?
Depending on the OS there are method to see who is maintaining the file open. I suppose you are on linux.. If not inspect also $^E to see last system error.
Your open is better written (as already pointed) in the 3 form; this as the avantage to have the path at disposition when printing errors.
You can also try to see if fileno returns something. Avoid also unnecessary parentheses
my $full_path = '/path/to/file'; #open my $fh, '>', $full_path or die "Unable to open [$full_path] to w +rite!"; # see tinita below.. open my $fh, '>', $full_path or die "Unable to open [$full_path] to wr +ite! $!"; ... # this one or some variation.. close $fh or warning "unable to close [$full_path] $! fileno: ".(filen +o $fh)." -e ".(-e $full_path); # more checks on directory? die if fileno $fh;
PS you have a typo in the title: correct it for future seekers
L*
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Failed to close file -- tests
by tinita (Parson) on Aug 24, 2019 at 12:47 UTC |