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.