I'm writing unit tests on some code that deals with the filesystem, and I'd like to demonstrate the code path works when close $fh or die $! fails. Any suggestions on how to trigger a failure in close()?
The first idea that occurs to me is to create a tiny loopback filesystem and write too many bytes to it and try to close it, but I'm wondering if there's an easier way.
I was hoping I could do local *other::package::close = sub { return 0 } in my test, but that doesn't take at all.
In reply to how to make close() fail by kgoess
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |