Device::SerialPort perl

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I am asking the Blinux list this question but it really belongs
on the perl beginners list which has died for some reason at my
location and isn't yet working again.

	I want to use an rs-232 port in several perl programs so
I used cpanp and installed the Device::SerialPort module and
tried running sample code to read lines of text from ports like
/dev/ttyS0 or /dev/ttyUSB1.

	I needed to use the lookfor function which will capture a
string of data until it encounters the pattern one has placed in
a parameter called are_match.  At that point, you have a string
within a variable that can be used in your program. The buffer is
cleared and ready for the next data ending in a matching pattern.

	I can't get it to work to save my soul and have been
looking for working examples of code.

	Has anybody gotten this to work and do you know of an
example of code that I can start from which should work?

	There is a test parameter called $port->input that echos
data which are being sent to the serial port and I have gotten
that to work but lookfor is not finding these days at my house.

	The perldoc for Device::SerialPort indicates that lookfor
will default to a newline or carriage return if you don't put
other patterns in so with nothing added, it should spit out a
line if it ends in newline or Return.

	Hopefully, I'll be back on the perl list soon, but no
telling when.

	I know my test code is defining the port right because
the test strings are perfect copies of the input data so that's
not what is wrong.  The lookfor function just rolls along and
never matches anything.

Thank you.

Martin McCormick

_______________________________________________
Blinux-list mailing list
Blinux-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/blinux-list



[Index of Archives]     [Linux Speakup]     [Fedora]     [Linux Kernel]     [Yosemite News]     [Big List of Linux Books]