This is probably obvious (but it caught me), but if anyone's using SysRW
directly, as I am, it's important to note that calling $sysrw->flush( $b )
doesn't always flush the entire buffer. If there's data left over, you have
to make sure it gets flushed out entirely, or you'll have data corruption
problems.
Since my $sysrw was going in and out of scope (and thus being created and
destroyed) as my event in question was being called, the few times when the
buffer didn't get entirely flushed, I ended up losing whatever was left over
when the object when out of scope. D'oh.
I fixed the problem with:
my $octets_left;
$driver->put( [ $input ] );
do {
$octets_left = $driver->flush( $self->{socket} );
} while ( $octets_left );