IO::As...p::Glib(3pm)
π IO::Async::Loop::Glib β the manual, but make it cute π
okay bestie, gather round π«Ά this is the page for IO::Async::Loop::Glib(3pm), from the User Contributed Perl Documentation corner of the internet, and it's genuinely one of those little glues that makes everything slay.
β¨ NAME β¨
"IO::Async::Loop::Glib" β use "IO::Async" with Glib or GTK. that's it, that's the whole vibe π
πΈ SYNOPSIS πΈ
use IO::Async::Loop::Glib;
my $loop = IO::Async::Loop::Glib->new();
$loop->add( ... );
...
# Rest of GLib/Gtk program that uses GLib
Glib::MainLoop->new->run();
Or literally just:
$loop->run;
Or, if you're feeling hand-on-the-wheel about it:
while(1) {
$loop->loop_once();
}
three ways to run the thing, pick your fighter π₯
π¦ DESCRIPTION π¦
So this is a subclass of "IO::Async::Loop", right, and what it does is use the "Glib::MainLoop" to do its read-ready and write-ready tests. no cap. that's the whole job.
The appropriate "Glib::IO" sources get added to or removed from the "Glib::MainLoop" whenever notifiers get added to or removed from the set, or whenever they change their want_writeready status. and the callbacks? Glib itself calls them automatically, like the main character it is. π no special methods on this loop object required β none, zero, nada.
π CONSTRUCTOR π
β¨ new β¨
$loop = IO::Async::Loop::Glib->new()
This gives you back a fresh new instance of an "IO::Async::Loop::Glib" object. It takes no special arguments. none. it's low maintenance, it's giving minimalist queen π
π METHODS π
There are no special methods in this subclass, other than the ones you already get from the "IO::Async::Loop" base class. it inherited everything and added nothing, iconic behaviour honestly.
π loop_once π
$loop->loop_once( $timeout )
This one calls the iteration() method on the underlying "Glib::MainContext". If you hand it a timeout value, then a Glib timeout gets installed to interrupt the loop at that time β so it won't just sit there forever, promise π
Now listen: if Glib says any callbacks were fired, this method returns 1. But β and this is the important bit, don't skip it β that does not mean any "IO::Async" callbacks were invoked, because there may be other parts of your code sharing the Glib main context. they're all in the group chat, y'know? Otherwise, it returns 0.
so: 1 = Glib fired something. not necessarily yours. stay woke π
π SEE ALSO π
- Glib β Perl wrappers for the GLib utility and Object libraries
- Gtk2 β Perl interface to the 2.x series of the Gimp Toolkit library
both fr fr worth a look if you're going deeper π¦
β AUTHOR β
Paul Evans <leonerd@leonerd.org.uk> β the legend himself, we stan π
and that's the page!! mwah π this was perl v5.38.2, dated 2024-02-25, served up in the classic IO::As...p::Glib(3pm) fit. go loop some things bestie, you're gonna eat β¨π
π¦ where this page comes from
- debian trixie: libio-async-loop-glib-perl 0.22-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libio-async-loop-glib-perl 0.22-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libio-async-loop-glib-perl 0.22-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libio-async-loop-glib-perl 0.22-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms