NAME
Test::Device::SerialPort - Serial port mock object to be used for testing
SYNOPSIS
use Test::Device::SerialPort;
my $PortObj = Test::Device::SerialPort->new('/dev/ttyS0');
$PortObj->baudrate(19200);
$PortObj->parity('none');
$PortObj->databits(8);
$PortObj->stopbits(1);
# Simulate read from port (can also read nothing)
my($count, $data) = $PortObj->read(100);
print "Read random data from serial [$data]\n";
# Simulate write to serial port
$count = $PortObj->write("MY_MESSAGE\r");
print "Written $count chars to test port\n";
# ...
DESCRIPTION
Nothing more. It's a test object that mimics the real Device::SerialPort thing. Used mainly for testing when I don't have an actual device to test.
STATUS
Started as a really sketchy and cheap way to mock serial port objects in unit tests.
Thanks to the work Bill Birthisel has put into this distribution, Test::Device::SerialPort
should now mimick a serial port fairly accurately.
SEE ALSO
KNOWN LIMITATIONS
The configuration file methods save and start have minimal support. Settings are not saved or restored although a two_line config file is created. restart is not supported yet. Nor are lockfiles nor "quiet mode". Tied filehandle methods are not supported yet either.
AUTHORS
Cosimo Streppone, <cosimo@cpan.org>
Additional support added by Bill Birthisel <wcbirthisel@alum.mit.edu>
COPYRIGHT AND LICENSE
Copyright (C) 2007, 2010 by Cosimo Streppone
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.