develooper Front page | perl.beginners | Postings from February 2002

Re: perl serial port program

Thread Previous | Thread Next
Papo Napolitano
February 28, 2002 14:51
Re: perl serial port program
Message ID:
I'm using the Device::SerialPort to monitor the logs from our Panasonic
phone system ;)
Take a look at CPAN.

It's as easy as:

use Device::SerialPort;
$port = new Device::SerialPort("/dev/ttyS0");
while (1) {
  $data = "";
  while (($data = $port->lookfor) eq "") {
    die "Device::SerialPort Aborted without match\n" unless (defined $data);
    select undef, undef, undef, 0.25; # Prevent the program to takeover the
CPU ;)

There, in $data you have a line up to the first \n.


----- Original Message -----
From: Jeff Liu
To: Beginners
Sent: Thursday, February 28, 2002 19:00
Subject: perl serial port program

Hi there,

I need to cook a perl script talking to /dev/ttyS0, it will be used to
monitor a RAID device via serial port. But even spending the whole day I was
still not lucky enough to be successful. Could you please show me a way to
deal with it?

Many thanks,
Jeff Liu

To unsubscribe, e-mail:
For additional commands, e-mail:

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About