in reply to strange behaviour with Device::SerialPort

You're nowhere creating an object my $port = Device::SerialPort->new( "/dev/ttyS1" );, so I'm not sure what you expect you code to do, or how opening the logfile is meant to be related to Device::SerialPort, or how this could ever have "worked as expected"...

Replies are listed 'Best First'.
Re^2: strange behaviour with Device::SerialPort
by fisher (Priest) on Nov 25, 2010 at 18:42 UTC
    No-no-no. Of course I created this object. And suddenly I realized I have no logfile. So I started to cut my script to minimal reproducible size. And so I came to this minimal script you see here in the post.
    My actual question was not about how to read from a serial port. I just wondering why its not writing to file when I use mentioned perl module.
      Ah, sorry, that wasn't clear to me from your original post.

      Maybe perl doesn't get around to flushing the file contents of L, because it prematurely quits for some reason related to Device::SerialPort (in some cleanup routine of the module?). Just a guess, though.

      I would try to explicitly close the file. Or use strace to figure out what is or isn't happening under the hood.