Test::MockCommand::TiedFH - emulate open() filehandle
This class pretends to be an open() filehandle to and/or from a pipe. It is either in recording mode or playback mode. It acts on a result object, and in recording mode it also uses an open filehandle to the real command.
In recording mode, it passes through read/write requests to the filehandle and appends the result to the result object before returning to the calling code.
In playback mode, it returns data exclusively from the result object and emulates the results the real file operations would give.
In some situations, two commands will be identical in invocation except for their input and output. The MockCommand framework handles this by passing control to the first result in the database, but giving it a list of all the other results.
If input is provided, we use all input we currently have and compare it to all the other results. If we find a unique match, we switch to using this result object.