Is there a method or module that allows me to simulate a fake filesystem for use with Perl unit testing?
I use a variety of Test::* and Test::Mock* modules in my unit testing, but occasionally I'd like to be able to fake a filesystem. A simple example (and a minimum requirement) would be faking the result from the -r or -f file test operators, so that when I call objects or modules that perform file tests, I can more easily control the result.
I know that there are all manner of ways of getting around this problem, such as creating temporary files or wrapping file tests in their own functions which can then be mocked, but sometimes it would be nice if I could just get Perl to lie to me... So solutions that suggest rewriting the code being tested are not required ;-)
Update:
After having just found and read this SO question, rewriting the code so that it is more testable is looking like the more sensible option. Still, fingers crossed...