in reply to Best way to read/write to a serial port
My guess is, after much googling, that the port is being blocked by the open command/while loop and making it to where I can't use another script to open the same port for write access. There are a number of Event modules in perl for handling event-driven communications, but after reading some posts here, seems like overkill for my simple app
it may seem that way, but you need something to arbitrate between the different processes contending for a given resource; a serial port can only do one thing at a time. While you can try leaving it up to the OS, without any guidance, the OS is most likely going to fall back on something simple/stupid like "first process that gets there monopolizes it until it's done", which is evidently what you're seeing.
My guess is select() is what you want. It may be annoyingly low level, but it was explicitly intended for this kind of situation, it's one of the builtins, thus guaranteed to be there, and it's a fairly old feature (read battle tested).
Or you can grab somebody's event module...
|
|---|