ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/AnyEvent/lib/AE.pm
(Generate patch)

Comparing AnyEvent/lib/AE.pm (file contents):
Revision 1.2 by root, Sun Aug 9 15:09:28 2009 UTC vs.
Revision 1.5 by root, Tue Jan 5 18:59:29 2010 UTC

9=head1 DESCRIPTION 9=head1 DESCRIPTION
10 10
11This module documents the new simpler AnyEvent API. 11This module documents the new simpler AnyEvent API.
12 12
13The rationale for the new API is that experience with L<EV> shows that 13The rationale for the new API is that experience with L<EV> shows that
14this API actually "works", despite it's lack of extensibility. 14this API actually "works", despite it's lack of extensibility, leading to
15a shorter, easier and faster API.
15 16
16The main difference to AnyEvent is that instead of method calls, function 17The main difference to AnyEvent is that instead of method calls, function
17calls are used, and that no named arguments are used. 18calls are used, and that no named arguments are used.
18 19
19This makes calls to watcher creation functions really short, which can 20This makes calls to watcher creation functions really short, which can
20make a program more readable, despite the lack of named parameters. 21make a program more readable, despite the lack of named parameters.
21Function calls also allow more static type checking than method calls, so 22Function calls also allow more static type checking than method calls, so
22many mistakes are caught at compiletime with this API. 23many mistakes are caught at compiletime with this API.
23 24
24Also, some backends (Perl and EV) are so fast that the method call 25Also, some backends (Perl and EV) are so fast that the method call
25overhead is very noticable (with EV it increases the time five- to 26overhead is very noticeable (with EV it increases the time five- to
26six-fold, with Perl the method call overhead is about a factor of two). 27six-fold, with Perl the method call overhead is about a factor of two).
27 28
28At the moment, there will be no checking (L<AnyEvent::Strict> does not 29At the moment, there will be no checking (L<AnyEvent::Strict> does not
29affect his API), so the L<AnyEvent> API has a definite advantage here 30affect his API), so the L<AnyEvent> API has a definite advantage here
30still. 31still.
31 32
32Note that the C<AE> API is an alternative to, not the future version of, 33Note that the C<AE> API is an alternative to, not the future version of,
33the AnyEvent API. Both APIs can be used interchangably and and there are 34the AnyEvent API. Both APIs can be used interchangably and and there are
34no plans to "switch", so if in doubt, use L<AnyEvent>'s API. 35no plans to "switch", so if in doubt, use the L<AnyEvent> API.
35 36
36As the AE API is complementary, not everything in the AnyEvent API is 37As the AE API is complementary, not everything in the AnyEvent API is
37available, so you still need to use AnyEvent for the finer stuff. Also, 38available, so you still need to use AnyEvent for the finer stuff. Also,
38you should not C<use AE> directly, C<use AnyEvent> will provide the AE 39you should not C<use AE> directly, C<use AnyEvent> will provide the AE
39namespace. 40namespace.
49=cut 50=cut
50 51
51package AE; 52package AE;
52 53
53use AnyEvent (); # BEGIN { AnyEvent::common_sense } 54use AnyEvent (); # BEGIN { AnyEvent::common_sense }
55
56our $VERSION = $AnyEvent::VERSION;
54 57
55=item $w = AE::io $fh_or_fd, $watch_write, $cb 58=item $w = AE::io $fh_or_fd, $watch_write, $cb
56 59
57Creates an I/O watcher that listens for read events (C<$watch_write> 60Creates an I/O watcher that listens for read events (C<$watch_write>
58false) or write events (C<$watch_write> is true) on the file handle or 61false) or write events (C<$watch_write> is true) on the file handle or

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines