Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

WHoo boy, do i have an interesting one here...I need to replace some ms-dos software that communicates to a barcode scanner via serial port, but I'm unsure of the protocol (if any) it uses. I'd like to use perl to help build replacement software so I can use said devices with win2k and/or linux.

Is there a way for me to, through perl, *listen* to the i/o of the serial port in a non-blocking manner (ie: not binding to the port)? That is to say, log to a file all input and output through the serial port, while still allowing any other program(s) to use the serial port at their leisure?

I just need to sit at the sideline and log the communications between the device and the client ms-dos program. Any help will be *greatly* appreciated

Replies are listed 'Best First'.
Re: Listening to I/O on serial port...
by marto (Cardinal) on Jul 28, 2005 at 13:58 UTC
Re: Listening to I/O on serial port...
by duff (Parson) on Jul 28, 2005 at 14:30 UTC

    You've been given some excellent software solutions so I thought I'd mention a hardware one. It's not too difficult to make (you may even be able to buy these) a "tee" cable that you can use to attach between your computer's serial port and the device such that all I/O is available to another serial port. You can then spy on your device's I/O without interfering at all with normal communications.

Re: Listening to I/O on serial port...
by davidrw (Prior) on Jul 28, 2005 at 14:09 UTC
    Take a look at the utilities at http://www.sysinternals.com -- i know among others very useful ones like FileMon and RegMon there is one that will monitor serial/parallel ports in real time (w/logging & filtering of course).
Re: Listening to I/O on serial port...
by zentara (Cardinal) on Jul 28, 2005 at 15:38 UTC
    The first thing that popped into my mind was the old Cuecat code. Do a google search for "Perl Cuecat".

    I'm not really a human, but I play one on earth. flash japh
Re: Listening to I/O on serial port...
by Anonymous Monk on Jul 29, 2005 at 13:46 UTC
    wow, got a lot of helpful replies. thansk everybody. the portmon program i can't use in msdos, only in win9x or higher, and i'm not totally sure how to redirect the i/o through the ::SerialPort modules, but the split cable might do the trick!

    thanks again for all the suggestions.