develooper Front page | perl.tcltk | Postings from July 2018

Re: status of fileevent support? (for use with Tcl::pTk)

Thread Next
Christopher Chavez
July 29, 2018 12:31
Re: status of fileevent support? (for use with Tcl::pTk)
Message ID:
(Continuing discussion from <> here per Vadim's suggestion)

> chrstphrchvz <> commented Jul 11, 2018, 3:06 PM CDT:
>> I came across an issue using fileevent from Tcl::pTk on macOS, which I've documented here: <>
>> I noticed there's comments in Tcl::pTk's fileevent <> suggesting it be rewritten, since it has known shortcomings (e.g. only supporting 'readable', relies on polling interval). Another suggestion it makes is for to support CreateFileHandler.
>> But do Tcl::Tk and/or Tkx already allow using fileevent 'as-is' through (I haven't yet successfully tried; is there a readily available example somewhere?) If that's the case, then I'm wondering if it's a matter of making Tcl::pTk recognize fileevent as something it should just pass through to if it's syntax is sufficiently compatible with Perl/Tk's.
vadrer <> commented Jul 12, 2018, 2:46 AM CDT:
> I haven't tried tcl/tk's fileevent, and actually I have no much plans on doing so.
> The reason is that I mostly use tcl/tk for GUI, and perl for IO;
> however it is possible to use tcl/tk's fileevent, but in this case we should expect for it to perform said IO.
> problem with Tcl::pTk could be that it should "join" perl IO and tcl/tk IO; which is not very easy, plus I do not foresee much benefits from doing so.

For the program I'm working on (cf. <>) the existing fileevent is for reading a serial port. It already uses separate read and write filehandles; it might be sufficient to use Tcl syntax to open a read handle for the device and make a fileevent for it (from Tcl rather than Perl), while continuing to use a Perl write filehandle in UI event callbacks.

For other uses, I'm not quite sure what the best approach will be. It doesn't seem possible to use some modern module like IO::Async in the same thread with e.g. Tcl::pTk due to separate event loops. If combining the file handles is best, that seems like something needing to be done from C/XS (not pure Perl or Tcl), which is what using Tcl_CreateFileHandler would entail.
Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About