… | |
… | |
18 | |
18 | |
19 | my $w = AnyEvent->condvar; # stores wether a condition was flagged |
19 | my $w = AnyEvent->condvar; # stores wether a condition was flagged |
20 | $w->wait; # enters "main loop" till $condvar gets ->broadcast |
20 | $w->wait; # enters "main loop" till $condvar gets ->broadcast |
21 | $w->broadcast; # wake up current and all future wait's |
21 | $w->broadcast; # wake up current and all future wait's |
22 | |
22 | |
23 | =head1 WHY YOU SHOULD USE THIS MODULE |
23 | =head1 WHY YOU SHOULD USE THIS MODULE (OR NOT) |
24 | |
24 | |
25 | Glib, POE, IO::Async, Event... CPAN offers event models by the dozen |
25 | Glib, POE, IO::Async, Event... CPAN offers event models by the dozen |
26 | nowadays. So what is different about AnyEvent? |
26 | nowadays. So what is different about AnyEvent? |
27 | |
27 | |
28 | Executive Summary: AnyEvent is I<compatible>, AnyEvent is I<free of |
28 | Executive Summary: AnyEvent is I<compatible>, AnyEvent is I<free of |
… | |
… | |
38 | programming (waiting for I/O or timer events) without subscribing to a |
38 | programming (waiting for I/O or timer events) without subscribing to a |
39 | religion, a way of living, and most importantly: without forcing your |
39 | religion, a way of living, and most importantly: without forcing your |
40 | module users into the same thing by forcing them to use the same event |
40 | module users into the same thing by forcing them to use the same event |
41 | model you use. |
41 | model you use. |
42 | |
42 | |
43 | For modules like POE or IO::Async (the latter of which is actually |
43 | For modules like POE or IO::Async (which is actually doing all I/O |
44 | named confusingly, as it does neither do I/O nor does it do anything |
|
|
45 | asynchronously...), using them in your module is like joining a |
44 | I<synchronously>...), using them in your module is like joining a |
46 | cult: After you joined, you are dependent on them and you cannot use |
45 | cult: After you joined, you are dependent on them and you cannot use |
47 | anything else, as it is simply incompatible to everything that isn't |
46 | anything else, as it is simply incompatible to everything that isn't |
48 | itself. |
47 | itself. |
49 | |
48 | |
50 | AnyEvent + POE works fine. AnyEvent + Glib works fine. AnyEvent + Tk |
49 | AnyEvent + POE works fine. AnyEvent + Glib works fine. AnyEvent + Tk |
… | |
… | |
58 | model>, AnyEvent also is free of bloat and policy: with POE or similar |
57 | model>, AnyEvent also is free of bloat and policy: with POE or similar |
59 | modules, you get an enourmous amount of code and strict rules you have |
58 | modules, you get an enourmous amount of code and strict rules you have |
60 | to follow. AnyEvent, on the other hand, is lean and to the point by only |
59 | to follow. AnyEvent, on the other hand, is lean and to the point by only |
61 | offering the functionality that is useful, in as thin as a wrapper as |
60 | offering the functionality that is useful, in as thin as a wrapper as |
62 | technically possible. |
61 | technically possible. |
|
|
62 | |
|
|
63 | Of course, if you want lots of policy (this is arguably somewhat useful |
|
|
64 | in many cases) and you want to force your users to the one and only event |
|
|
65 | model your module forces on them, you should I<not> use this module. |
63 | |
66 | |
64 | |
67 | |
65 | =head1 DESCRIPTION |
68 | =head1 DESCRIPTION |
66 | |
69 | |
67 | L<AnyEvent> provides an identical interface to multiple event loops. This |
70 | L<AnyEvent> provides an identical interface to multiple event loops. This |