This file is indexed.

/usr/lib/perl5/AE.pm is in libanyevent-perl 7.070-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
=head1 NAME

AE - simpler/faster/newer/cooler AnyEvent API

=head1 SYNOPSIS

  use AnyEvent; # not AE

  # file handle or descriptor readable
  my $w = AE::io $fh, 0, sub { ...  };

  # one-shot or repeating timers
  my $w = AE::timer $seconds,         0, sub { ... }; # once
  my $w = AE::timer $seconds, $interval, sub { ... }; # repeated

  print AE::now;  # prints current event loop time
  print AE::time; # think Time::HiRes::time or simply CORE::time.

  # POSIX signal
  my $w = AE::signal TERM => sub { ... };

  # child process exit
  my $w = AE::child $pid, sub {
     my ($pid, $status) = @_;
     ...
  };

  # called when event loop idle (if applicable)
  my $w = AE::idle sub { ... };

  my $cv = AE::cv; # stores whether a condition was flagged
  $cv->send; # wake up current and all future recv's
  $cv->recv; # enters "main loop" till $condvar gets ->send
  # use a condvar in callback mode:
  $cv->cb (sub { $_[0]->recv });


=head1 DESCRIPTION

This module documents the new simpler AnyEvent API.

The rationale for the new API is that experience with L<EV> shows that
this API actually "works", despite its lack of extensibility, leading to
a shorter, easier and faster API.

The main differences from AnyEvent is that function calls are used
instead of method calls, and that no named arguments are used.

This makes calls to watcher creation functions really short, which can
make a program more readable despite the lack of named parameters.
Function calls also allow more static type checking than method calls, so
many mistakes are caught at compile-time with this API.

Also, some backends (Perl and EV) are so fast that the method call
overhead is very noticeable (with EV it increases the execution time five-
to six-fold, with Perl the method call overhead is about a factor of two).

Note that the C<AE> API is an alternative to, not the future version of,
the AnyEvent API. Both APIs can be used interchangeably and there are
no plans to "switch", so if in doubt, feel free to use the L<AnyEvent>
API in new code.

As the AE API is complementary, not everything in the AnyEvent API is
available, and you still need to use AnyEvent for the finer stuff. Also,
you should not C<use AE> directly, C<use AnyEvent> will provide the AE
namespace.

At the moment, these functions will become slower then their method-call
counterparts when using L<AnyEvent::Strict> or L<AnyEvent::Debug>::wrap.

=head2 FUNCTIONS

This section briefly describes the alternative watcher constructors and
other functions available inside the C<AE> namespace. Semantics are not
described here; please refer to the description of the function or method
with the same name in the L<AnyEvent> manpage for the details.

=over 4

=cut

package AE;

use AnyEvent (); # BEGIN { AnyEvent::common_sense }

our $VERSION = $AnyEvent::VERSION;

=item $w = AE::io $fh_or_fd, $watch_write, $cb

Creates an I/O watcher that listens for read events (C<$watch_write>
false) or write events (C<$watch_write> is true) on the file handle or
file descriptor C<$fh_or_fd>.

The callback C<$cb> is invoked as soon and as long as I/O of the type
specified by C<$watch_write>) can be done on the file handle/descriptor.

Example: wait until STDIN becomes readable.

  $stdin_ready = AE::io *STDIN, 0, sub { scalar <STDIN> };

Example: wait until STDOUT becomes writable and print something.

  $stdout_ready = AE::io *STDOUT, 1, sub { print STDOUT "woaw\n" };

=item $w = AE::timer $after, $interval, $cb

Creates a timer watcher that invokes the callback C<$cb> after at least
C<$after> second have passed (C<$after> can be negative or C<0>).

If C<$interval> is C<0>, then the callback will only be invoked once,
otherwise it must be a positive number of seconds that specifies the
interval between successive invocations of the callback.

Example: print "too late" after at least one second has passed.

  $timer_once = AE::timer 1, 0, sub { print "too late\n" };

Example: print "blubb" once a second, starting as soon as possible.

  $timer_repeated = AE::timer 0, 1, sub { print "blubb\n" };

=item $w = AE::signal $signame, $cb

Invoke the callback C<$cb> each time one or more occurrences of the
named signal C<$signame> are detected.

=item $w = AE::child $pid, $cb

Invokes the callback C<$cb> when the child with the given C<$pid> exits
(or all children, when C<$pid> is zero).

The callback will get the actual pid and exit status as arguments.

=item $w = AE::idle $cb

Invoke the callback C<$cb> each time the event loop is "idle" (has no
events outstanding), but do not prevent the event loop from polling for
more events.

=item $cv = AE::cv

=item $cv = AE::cv { BLOCK }

Create a new condition variable. The first form is identical to C<<
AnyEvent->condvar >>, the second form additionally sets the callback (as
if the C<cb> method is called on the condition variable).

=item AE::now

Returns the current event loop time (may be cached by the event loop).

=item AE::now_update

Ensures that the current event loop time is up to date.

=item AE::time

Return the current time (not cached, always consults a hardware clock).

=item AE::postpone { BLOCK }

Exactly the same as C<AnyEvent:::postpone>.

=item AE::log $level, $msg[, @args]

Exactly the same as C<AnyEvent::log> (or C<AnyEvent::Log::log>).

=back

=head1 AUTHOR

 Marc Lehmann <schmorp@schmorp.de>
 http://anyevent.schmorp.de

=cut

1