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

Re: Serial Ports and Perl

Hi Martin,

On Thu, Oct 26, 2017 at 07:37:07PM -0500, Martin McCormick wrote:
> 	If anybody has gotten the perl Device::SerialPort to
> work, I am interested to know what I am doing or not doing.

I have been using it successfully for a long time, but all I do is
read whole lines from the serial device like:

my $dev  = '/dev/ttyUSB0';
my $port = Device::SerialPort->new($dev);


open my $fh, '<', $dev or die "Can't open $dev: $!";

while (<$fh>) {
    print "READ: $_\n";

So, I am only using Device::SerialPort to configure the device,
while all reading is done by treating it as a normal file.

I see you are using lookfor(), which I have never used before. From
a brief look at:


it seems you should be setting are_match() if you want lookfor() to
match anything.


https://bitfolk.com/ -- No-nonsense VPS hosting

Reply to: