AnyEvent::Impl::Tk(3)
Bestie, welcome to AnyEvent::Impl::Tk(3), fresh from the User Contributed Perl Documentation pile, and it's giving "AnyEvent adaptor for Tk" with a side of chaotic Tk slander ๐
โจ
โจ NAME โจ
AnyEvent::Impl::Tkโ AnyEvent adaptor for Tk. That's the whole name, periodt ๐
๐ฆ SYNOPSIS ๐ฆ
use AnyEvent;
use Tk;
# this module gets loaded automatically as required
๐ DESCRIPTION ๐
This module provides transparent support for AnyEvent. You literally don't have to do anything to make Tk work with AnyEvent except by loading Tk before creating the first AnyEvent watcher. That's it. No secret handshake, no extra setup, just load Tk first and vibe ๐ซถ
Okay, now hold my hand while we get into it: Tk is buggy. Tk is extremely buggy. Tk is so unbelievably buggy that for each bug reported and fixed, you get one new bug followed by reintroduction of the old bug in a later revision ๐ญ It is also basically unmaintained: the maintainers are not even interested in improving the situation โ reporting bugs is considered rude, and fixing bugs is considered changing holy code, so it's apparently better to leave it broken. The author regularly runs out of words to describe how bad it really is ๐
To work around some of the many, many bugs in Tk that don't get fixed, this adaptor dup()'s all filehandles that get passed into its I/O watchers. So if you register a read and a write watcher for one fh, AnyEvent will create two additional file descriptors (and handles) ๐ฎโ๐จ
This creates a high overhead and is slow, but seems to work around most known bugs in Tk::fileevent on 32 bit architectures (Tk seems to be terminally broken on 64 bit, do not expect more than 10 or so watchers to work on 64 bit machines). Lowkey a whole situation, but there it is ๐ฆ
Do not expect these workarounds to avoid segfaults and crashes inside Tk. Like, they are not a magical little shield, bestie ๐ญ๐ก๏ธ
Note also that Tk event ids wrap around after 2**32 or so events, which on the author's machine can happen within less than 12 hours, after which Tk will stomp on random other events and kill them. So don't run Tk programs for more than an hour or so. Consider that your official group-chat warning ๐จ
To be able to access the Tk event loop, this module creates a main window and withdraws it immediately. This might cause flickering on some platforms, but Tk perversely requires a window to be able to wait for file handle readyness notifications. This window is always created (in this version of AnyEvent) and can be accessed as $AnyEvent::Impl::Tk::mw ๐
๐ SEE ALSO ๐
AnyEvent, Tk โ go read those too, bestie ๐โจ
๐ AUTHOR ๐
Marc Lehmann <schmorp@schmorp.de>http://anyevent.schmorp.de
Give them a little virtual hug for surviving all this Tk nonsense ๐ซถ
Okay bye bestie ๐ โ source/version: perl v5.42.0 โข date: 2019-09-18 โข page: AnyEvent::Impl::Tk(3) โข mwah, slay, and may your watchers stay un-stomped ๐โจ
๐ฆ where this page comes from
- opensuse-leap 16.0: perl-AnyEvent 7.17-160000.2.2 ยท GPL-1.0-or-later OR Artistic-1.0
- opensuse-leap 16.0: perl-AnyEvent 7.17-160000.2.2 ยท GPL-1.0-or-later OR Artistic-1.0
- opensuse-leap 16.0: perl-AnyEvent 7.17-160000.2.2 ยท GPL-1.0-or-later OR Artistic-1.0
- opensuse-leap 16.0: perl-AnyEvent 7.17-160000.2.2 ยท GPL-1.0-or-later OR Artistic-1.0
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms