AnyEvent
view release on metacpan or search on metacpan
- load /etc/hosts only when DNS has no answer.
- stat /etc/hosts on every access and reload it if it changed.
- load /etc/hosts via AnyEvent::IO - potentially asynchronous.
- fix a buggy croak in the dh parameter reading in AnyEvent::TLS.
- AnyEvent::Log log_to_file and log_to_path now use AnyEvent::IO. As
a side effect, they now use true appending as opposed to libc
appending, and the file might not have been opened when the function
returns.
- the default logging level was not properly documented in a variety of
places, this has hopefully been rectified.
- updated uts46data.pl for unicode 6.1.0.
- made log messages generated by AnyEvent submodules not
include the package name anymore, as it will be logged
by default already.
- upgrade to the trick used by common-sense 3.5 to work
around extra warning torture/breakage under perl 5.15.x.
- log messages by anyevent are now ucfirst, are usually full
sentences and do no longer include the package name.
- the storable read type would sometimes throw an exception instead
of causing EBADMSG (analyzed by Maxime Soulé).
- work around a bug in openssl 1.0.1 which enforces a minimum rsa
4.451 Fri Jul 3 00:28:58 CEST 2009
- do not clear rbuf when shutting down an AnyEvent::Handle
object - doing so breaks AnyEvent::HTTP.
4.45 Mon Jun 29 22:59:26 CEST 2009
- a write error could cause AnyEvent::Handle to create
an I/O watcher with an undefined $fh.
- special-case mapped ipv4 addresses in both
AnyEvent::Socket::format_address and parse_address,
to treat them just like ipv4 addresses.
- updated and overhauled the AnyEvent::Intro doc.
- implement AnyEvent::Socket::format_ipv4/ipv6.
- slightly speed up portable_pipe/socketpair.
- expand condvar begin/end documentation.
4.42 Fri Jun 26 08:32:18 CEST 2009
- preliminary and neccesarily incomplete support for IO::Async.
- reset SIGCHLD to DEFAULT when AnyEvent is loaded, in
case it was set to IGNORE, to ensure we can catch child statuses
even when the calling env acts stupidly.
- updated benchmarks with IO::Async, which performs very well.
4.412 Wed Jun 24 01:35:57 CEST 2009
- support an "untaint" attribute for AnyEvent::DNS
and set it on the default resolver.
- implement and document AnyEvent::Impl::Perl::loop.
- remove all anyevent-env variables from %ENV
when running in tainted mode.
- mention and extend the IO::Lambda benchmark.
4.411 Sun Jun 7 18:48:02 CEST 2009
- try to use a fallback dns server if no dns servers could be found.
- splatter around some local $SIG{__DIE__}'s to work around bad
die handlers.
4.03 Sun May 25 05:05:57 CEST 2008
- work around perl bugs on windows, where perl returns undocumented
error codes for sysread, syswrite etc.
- fix AnyEvent::Handle::unshift_read to really unshift and not push.
- AnyEvent::Handle could sometimes stumble over 0-byte writes.
- fix unpack_sockaddr, now works for AF_INET6 sockaddr's.
- updated documentation.
- lots of workarounds for perl 5.8 quirks.
- implement a more flexible type system for both reads and writes
in AnyEvent::Handle.
- support IPv6 in tcp_server.
- pass local hostname and port to the prepare callback in tcp_server.
- make types extendable in AnyEvent::Handle.
- croak, not die, in AnyEvent::Handle;
4.0 Sat May 24 19:58:08 CEST 2008
- added (experimental) AnyEvent::DNS module.
AnyEvent has two additional methods that return the "current time":
AnyEvent->time
This returns the "current wallclock time" as a fractional number of
seconds since the Epoch (the same thing as "time" or
"Time::HiRes::time" return, and the result is guaranteed to be
compatible with those).
It progresses independently of any event loop processing, i.e. each
call will check the system clock, which usually gets updated
frequently.
AnyEvent->now
This also returns the "current wallclock time", but unlike "time",
above, this value might change only once per event loop iteration,
depending on the event loop (most return the same time as "time",
above). This is the time that AnyEvent's timers get scheduled
against.
*In almost all cases (in all cases if you don't care), this is the
AnyEvent::Impl::EV (source code), AnyEvent::Impl::Glib (Source code) and
so on for actual examples. Use "perldoc -m AnyEvent::Impl::Glib" to see
the sources.
If you don't provide "signal" and "child" watchers than AnyEvent will
provide suitable (hopefully) replacements.
The above example isn't fictitious, the *rxvt-unicode* (a.k.a. urxvt)
terminal emulator uses the above line as-is. An interface isn't included
in AnyEvent because it doesn't make sense outside the embedded
interpreter inside *rxvt-unicode*, and it is updated and maintained as
part of the *rxvt-unicode* distribution.
*rxvt-unicode* also cheats a bit by not providing blocking access to
condition variables: code blocking while waiting for a condition will
"die". This still works with most modules/usages, and blocking calls
must not be done in an interactive application, so it makes sense.
EXAMPLE PROGRAM
The following program uses an I/O watcher to read data from STDIN, a
timer to display a message once per second, and a condition variable to
lib/AnyEvent.pm view on Meta::CPAN
=over 4
=item AnyEvent->time
This returns the "current wallclock time" as a fractional number of
seconds since the Epoch (the same thing as C<time> or C<Time::HiRes::time>
return, and the result is guaranteed to be compatible with those).
It progresses independently of any event loop processing, i.e. each call
will check the system clock, which usually gets updated frequently.
=item AnyEvent->now
This also returns the "current wallclock time", but unlike C<time>, above,
this value might change only once per event loop iteration, depending on
the event loop (most return the same time as C<time>, above). This is the
time that AnyEvent's timers get scheduled against.
I<In almost all cases (in all cases if you don't care), this is the
function to call when you want to know the current time.>
lib/AnyEvent.pm view on Meta::CPAN
L<AnyEvent::Impl::EV> (source code), L<AnyEvent::Impl::Glib> (Source code)
and so on for actual examples. Use C<perldoc -m AnyEvent::Impl::Glib> to
see the sources.
If you don't provide C<signal> and C<child> watchers than AnyEvent will
provide suitable (hopefully) replacements.
The above example isn't fictitious, the I<rxvt-unicode> (a.k.a. urxvt)
terminal emulator uses the above line as-is. An interface isn't included
in AnyEvent because it doesn't make sense outside the embedded interpreter
inside I<rxvt-unicode>, and it is updated and maintained as part of the
I<rxvt-unicode> distribution.
I<rxvt-unicode> also cheats a bit by not providing blocking access to
condition variables: code blocking while waiting for a condition will
C<die>. This still works with most modules/usages, and blocking calls must
not be done in an interactive application, so it makes sense.
=head1 EXAMPLE PROGRAM
The following program uses an I/O watcher to read data from STDIN, a timer
lib/AnyEvent/Log.pm view on Meta::CPAN
logging - when the C<logger> function is called once, but the returned
logger callback often, then this can be a tremendous speed win.
Despite this speed advantage, changes in logging configuration will
still be reflected by the logger callback, even if configuration changes
I<after> it was created.
To further speed up logging, you can bind a scalar variable to the logger,
which contains true if the logger should be called or not - if it is
false, calling the logger can be safely skipped. This variable will be
updated as long as C<$logger> is alive.
Full example:
# near the init section
use AnyEvent::Log;
my $debug_log = AnyEvent:Log::logger debug => \my $debug;
# and later in your program
$debug_log->("yo, stuff here") if $debug;
( run in 0.336 second using v1.01-cache-2.11-cpan-05444aca049 )