Hi everybody! I'm currently putting the finishing touch on a new module (Device::Symcod::RS422) that communicates with devices over a serial link. In the process of writing tests for that module, I found myself needing to fake the presence of such a device, that could communicate as needed with a function without further intervention on my part.
To my surprise, I couldn't find any module that would do this, so I wrote my own. To quote from the manpage: IO::FakeTty creates a pseudo-terminal (also known as "pseudo tty" or "pty") and attaches a talker/listener slave to the other end. The slave can then be instructed to write to the pty, or read from it and return its contents. Since the slave runs in a separate process, this can be done in parallel with the execution of the main program. This module is primarily intended for testing Perl code which interacts with a terminal. Given a black-box function or method, you can determine what it sends to its tty, and how it reacts when fed a given input. (This is somewhat the opposite of Test::Expect, which tests applications from the outside, while IO::FakeTty allows testing Perl code from the inside.) Before uploading this module to CPAN, I have three questions: 1. Did I re-invent the wheel? As I said, I couldn't find anything out there that did the job, but maybe I missed something obvious. 2. Did I miss a more elegant or easier solution? Intuitively, I'm inclined to believe that a tied filehandle would not have been applicable, but I could be wrong. 3. What would be a more appropriate name for this module? I opted against Test::*, since this is not a test module per se. Would it make sense to move it into the IO::Tty namespace (IO::Tty::FakeDevice, maybe?), even though there's already a distribution by that name? Thanks! -- Maybe it's time to break that. -- Larry Wall in <199710311718.jaa19...@wall.org>