Hi Papo,
Thank you very much for your information. I can send to serial port from my script now. But when I try to read from the port, my script died and showed "Device::SerialPort Aborted without match". Do you have any idea about how can I fix the problem? My script is as followed. #!/usr/bin/perl use Device::SerialPort; $port = new Device::SerialPort("/dev/ttyS0"); $port->user_msg(ON); $port->baudrate(9600); $port->parity("none"); $port->databits(8); $port->stopbits(1); $port->handshake("xoff"); $port->write_settings; while (1) { $bytein=""; $port->lookclear; $port->write("Feed Me:"); $port->write("#"); while ($bytein eq "") { $bytein = $port->lookfor; die "Device::SerialPort Aborted without match\n" unless (defined $data); sleep 1; } print "$bytein\n"; } $port->close(); -----Original Message----- From: Papo Napolitano [mailto:[EMAIL PROTECTED]] Sent: February 28, 2002 5:51 PM To: Jeff Liu; Beginners Subject: Re: perl serial port program 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"); $port->baudrate(9600); $port->parity("none"); $port->databits(8); $port->stopbits(1); $port->handshake("rts"); $port->write_settings; 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. HTH.- ----- 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]