In the call-back code you can directly interact with other widgets - e.g. change the text of a widget, etc.$widget->fileevent($fh, 'readable' => sub { ...call-back code... });
Also, since you are accessing the serial port as /dev/ttyS0, you should just be able to open and read/write to it directly just like any other file object:
The Device::SerialPort module is still useful for configuring the port, but it's not needed to read/write to it. One additional configuration you might want to use it to put the port into 'raw' mode instead of line-buffered mode. To be honest, I'm not really sure how it's done with Device::SerialPort -- I've always used the old-school system("stty -F /dev/ttyS0 raw"). :-)open(S, '+<', '/dev/ttyS0'); read(S, $buf, 1024, length($buf)); print S "etc.\n";
Finally, I haven't tried it, but judging from this example code, file event call-backs should work even in a Win32 environment.
Update: Have a look at this page for an example of the fileevent call-back (under 'Executing Nonblocking System Commands') The code reads from a pipe, but the principle is the same with a serial port.
In reply to Re: Posting thread data in a Perl/Tk window
by pc88mxer
in thread Posting thread data in a Perl/Tk window
by Bruce32903
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |