in reply to Mocking files for reading

I think the closest you can get is using a tied filehandle. This would nicely get you around all the problems like print not being overridable, etc.   See this node for a simple example.