Without knowing how AnyEvent works, if the handler involves threads
then calling *any* GTK+ API from different threads than the one that
called `gtk_main()` is going to blow up your application. Even if it
worked in one release, during a specific alignment of planets, or if
you placed the machines in a pentacle drawn in goat blood, there's no
guarantee that it'll keep working. GTK+ simply does *not* support
multi-threaded access of the windowing system resources.
GTK+ and the G* platform has a whole bunch of API to deal with these
cases, like GTask[0]. Sadly, it's not very Perlish because nobody
wrote introspection overrides for it. Additionally, for things like
HTTP requests, there's a whole library called libsoup[1] which
integrates with the GLib main loop.
Ciao,
Emmanuele.