in reply to mocking or trapping system calls

You might like to know I wrote a CPAN module to mock system calls, by recording the real thing and playing it back later. It's called Test::MockCommand and, with the above discussion as a caveat, captures most ways of invoking an external command in Perl.

http://search.cpan.org/~kyz/Test-MockCommand-0.02/