I need to test the open function
I think it's slightly pointless to test the open function itself. If you think there's a chance that it may fail of its own accord (other than for resource acquisition issues) then you're probably worrying too hard. The test suite of perl itself ensures that it works correctly. At some point you have to take it as a given that the foundation is solid, and build upon it.
That said...
I need a file that I'm quite certain that exists
A better idea than $0 would be to open the null device (that's what it's there for). This can be done portably with the File::Spec module. You can read or write to it to your heart's content.
my $devnull = File::Spec->devnull(); open my $in, '<', $devnull or die "failed to open $devnull: $!\n";
• another intruder with the mooring in the heart of the Perl
In reply to Re: an ever-available file for opening
by grinder
in thread an ever-available file for opening
by Sixtease
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |