[Pdx-pm] anyone have experience using ircomm with perl?

Todd Caine todd_caine at eli.net
Mon Sep 8 19:26:07 CDT 2003


On (Mon, Sep 08 16:25), Chris Dawson wrote:
> I have tried to write a script which reads/writes to the IrCOMM device 
> /dev/ircomm0.  I am getting some strange results, but I have never done 
> anything like this before.

My only suggestion about communicating with a serial port is to use either
Device::SerialPort or Win32::SerialPort which are both available via the 

> if( open FILE, "/dev/ircomm0" ) {
> print "Opened the port.\n";
> while( <FILE> ) {
> print $_ . "\n";
> }
> print "Closed port.\n";
> }

When open() fails you can find out why by using $!.

  if (open FILE, '/some/file') {
  else {
    warn "can't open /some/file for reading: $!\n";

Although it *might* be better to die() when you can't open the file.

  open FILE, '/some/file' 
    or die "can't open /some/file for reading: $!\n";


More information about the Pdx-pm-list mailing list