Perl Monk, Perl Meditation | |
PerlMonks |
how to make close() failby kgoess (Beadle) |
on Sep 29, 2012 at 00:34 UTC ( [id://996306]=perlquestion: print w/replies, xml ) | Need Help?? |
kgoess has asked for the wisdom of the Perl Monks concerning the following question: 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.
Back to
Seekers of Perl Wisdom
|
|