in reply to File open issue
The AM has one reasonable solution, but it assumes that the only failure mode that the $nofile variable applies to is the case where the file is not readable at the time it is tested.
If you can live with those conditions, great. Otherwise, another solution (similar to yours) might be:
my $nofile; my $reason; my $tempfile = "$tempdir/$ENV{'REMOTE_ADDR'}"; my @tmpfile; if ( open( my $temp_fh, "<", $tempfile ) ) { @tmpfile = <$temp_fh>; close( $temp_fh ); # You don't need this, $temp_fh should be limit +ed in scope } else { $nofile = 1; $reason = $!; # update: original typo == $@ }
--MidLifeXis
|
|---|