Gtk2 programs you have to rely on the Glib module - you should load the
event module before loading AnyEvent or any module that uses it: generally
speaking, you should load it as early as possible. The reason is that
modules might create watchers when they are loaded, and AnyEvent will
decide on the event model to use as soon as it creates watchers, and it
might chose the wrong one unless you load the correct one yourself.
You can chose to use a pure-perl implementation by loading the
C<AnyEvent::Impl::Perl> module, which gives you similar behaviour
everywhere, but letting AnyEvent chose the model is generally better.
=head2 MAINLOOP EMULATION
Sometimes (often for short test scripts, or even standalone programs who
only want to use AnyEvent), you do not want to run a specific event loop.
In that case, you can use a condition variable like this:
AnyEvent->condvar->recv;
This has the effect of entering the event loop and looping forever.
Note that usually your program has some exit condition, in which case
it is better to use the "traditional" approach of storing a condition
variable somewhere, waiting for it, and sending it when the program should
exit cleanly.
=head1 OTHER MODULES
The following is a non-exhaustive list of additional modules that use
AnyEvent and can therefore be mixed easily with other AnyEvent modules
in the same program. Some of the modules come with AnyEvent, some are
available via CPAN.
=over 4
=item L<AnyEvent::Util>
Contains various utility functions that replace often-used but blocking
functions such as C<inet_aton> by event-/callback-based versions.
=item L<AnyEvent::Handle>
Provide read and write buffers and manages watchers for reads and writes.
=item L<AnyEvent::Socket>
Provides various utility functions for (internet protocol) sockets,
addresses and name resolution. Also functions to create non-blocking tcp
connections or tcp servers, with IPv6 and SRV record support and more.
=item L<AnyEvent::DNS>
Provides rich asynchronous DNS resolver capabilities.
=item L<AnyEvent::HTTP>
A simple-to-use HTTP library that is capable of making a lot of concurrent
HTTP requests.
=item L<AnyEvent::HTTPD>
Provides a simple web application server framework.
=item L<AnyEvent::FastPing>
The fastest ping in the west.
=item L<AnyEvent::DBI>
Executes DBI requests asynchronously in a proxy process.
=item L<Net::IRC3>
AnyEvent based IRC client module family.
=item L<Net::XMPP2>
AnyEvent based XMPP (Jabber protocol) module family.
=item L<Net::FCP>
AnyEvent-based implementation of the Freenet Client Protocol, birthplace
of AnyEvent.
=item L<Event::ExecFlow>
High level API for event-based execution flow control.
=item L<Coro>
Has special support for AnyEvent via L<Coro::AnyEvent>.
=item L<AnyEvent::AIO>, L<IO::AIO>
Truly asynchronous I/O, should be in the toolbox of every event
programmer. AnyEvent::AIO transparently fuses IO::AIO and AnyEvent
together.
=8= |