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

I have fiddled some more with this serial logging. I'm ultimately trying to log the smdr output from a telephone switchboard (PBX), but I seem to be getting only intermittent success. My poll currently looks like this:
for(;;){ my $result=$PortObj->input; if($result =~ m/foo/){ $count++; my $query="INSERT INTO logs(cl_date, cl_dialled) value +s(now(),'$count')"; my $clsth=&db_query($query); } }
In this experiment I am then sending strings down the serial connection from the other box with:
bash-2.05b# echo "foo" >> /dev/ttyS0 bash-2.05b# echo "foo" >> /dev/ttyS0 bash-2.05b# echo "foo" >> /dev/ttyS0
heh - you get the idea.. However, there seems to be some mad entropy behind whether or not I detect anything at the logging end - If I sent 4 lines, I might only get 1 or 2 new rows in the databse - then perhaps I'll send 8 lines and get nothing, so then I'll restart the logger and send 5 lines.. and I get 3 new entries in the database... What I'm trying to say is that it's totally random whether or not the text gets picked up at the other end. I guess I generally manage to log 10-20% of the strings that get sent down.

For info, here is the result from stty on /dev/ttyS0 - I also turned on IGNBRK.
root@alexis:/export/serial/# stty -a < /dev/ttyS0 speed 9600 baud; rows 0; columns 0; line = 0; intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; +eol2 = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0; -parenb -parodd cs8 hupcl -cstopb cread clocal -crtscts -ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl -i +xon -ixoff -iuclc -ixany -imaxbel -opost -olcuc -ocrnl -onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 +bs0 vt0 ff0 -isig -icanon -iexten -echo -echoe -echok -echonl -noflsh -xcase -tost +op -echoprt -echoctl -echoke
now, I wonder if there is some way that Device::SerialPort can be made to detect that Data is ready to send, rather than just polling - am I going about this the wrong way?

thanks for your help,
christo :)