--- AnyEvent/lib/AnyEvent.pm 2010/08/31 00:59:55 1.330 +++ AnyEvent/lib/AnyEvent.pm 2011/02/24 12:04:20 1.348 @@ -48,7 +48,9 @@ =head1 SUPPORT -There is a mailinglist for discussing all things AnyEvent, and an IRC +An FAQ document is available as L. + +There also is a mailinglist for discussing all things AnyEvent, and an IRC channel, too. See the AnyEvent project page at the B, AnyEvent also is free of bloat and policy: with POE or similar @@ -121,14 +123,12 @@ During the first call of any watcher-creation method, the module tries to detect the currently loaded event loop by probing whether one of the -following modules is already loaded: L, -L, L, L, L, L, L, -L. The first one found is used. If none are found, the module tries -to load these modules (excluding Tk, Event::Lib, Qt and POE as the pure perl -adaptor should always succeed) in the order given. The first one that can -be successfully loaded will be used. If, after this, still none could be -found, AnyEvent will fall back to a pure-perl event loop, which is not -very efficient, but should work everywhere. +following modules is already loaded: L, L, +L, L, L, L, L, L. The first one +found is used. If none are detected, the module tries to load the first +four modules in the order given; but note that if L is not +available, the pure-perl L should always work, so +the other two are not normally tried. Because AnyEvent first checks for modules that are already loaded, loading an event model explicitly before first using AnyEvent will likely make @@ -878,6 +878,8 @@ AnyEvent::Impl::EventLib based on Event::Lib, leaks memory and worse. AnyEvent::Impl::POE based on POE, very slow, some limitations. AnyEvent::Impl::Irssi used when running within irssi. + AnyEvent::Impl::IOAsync based on IO::Async. + AnyEvent::Impl::Cocoa based on Cocoa::EventLoop. =item Backends with special needs. @@ -888,14 +890,6 @@ AnyEvent::Impl::Qt based on Qt. -Support for IO::Async can only be partial, as it is too broken and -architecturally limited to even support the AnyEvent API. It also -is the only event loop that needs the loop to be set explicitly, so -it can only be used by a main program knowing about AnyEvent. See -L for the gory details. - - AnyEvent::Impl::IOAsync based on IO::Async, cannot be autoprobed. - =item Event loops that are indirectly supported via other backends. Some event loops can be supported via other modules: @@ -1159,8 +1153,8 @@ # basically a tuned-down version of common::sense sub common_sense { - # from common:.sense 1.0 - ${^WARNING_BITS} = "\xfc\x3f\x33\x00\x0f\xf3\xcf\xc0\xf3\xfc\x33\x00"; + # from common:.sense 3.4 + ${^WARNING_BITS} ^= ${^WARNING_BITS} ^ "\x3c\x3f\x33\x00\x0f\xf0\x0f\xc0\xf0\xfc\x33\x00"; # use strict vars subs - NO UTF-8, as Util.pm doesn't like this atm. (uts46data.pl) $^H |= 0x00000600; } @@ -1169,7 +1163,7 @@ use Carp (); -our $VERSION = '5.271'; +our $VERSION = '5.33'; our $MODEL; our $AUTOLOAD; @@ -1217,14 +1211,8 @@ [POE::Kernel:: => AnyEvent::Impl::POE::], # lasciate ogni speranza [Wx:: => AnyEvent::Impl::POE::], [Prima:: => AnyEvent::Impl::POE::], - # IO::Async is just too broken - we would need workarounds for its - # byzantine signal and broken child handling, among others. - # IO::Async is rather hard to detect, as it doesn't have any - # obvious default class. - [IO::Async:: => AnyEvent::Impl::IOAsync::], # requires special main program - [IO::Async::Loop:: => AnyEvent::Impl::IOAsync::], # requires special main program - [IO::Async::Notifier:: => AnyEvent::Impl::IOAsync::], # requires special main program - [AnyEvent::Impl::IOAsync:: => AnyEvent::Impl::IOAsync::], # requires special main program + [IO::Async::Loop:: => AnyEvent::Impl::IOAsync::], + [Cocoa::EventLoop:: => AnyEvent::Impl::Cocoa::], ); our %method = map +($_ => 1), @@ -1293,7 +1281,7 @@ } $MODEL - or die "No event module selected for AnyEvent and autodetect failed. Install any one of these modules: EV, Event or Glib.\n"; + or die "AnyEvent: backend autodetection failed - did you properly install AnyEvent?\n"; } } @@ -1302,14 +1290,18 @@ push @{"$MODEL\::ISA"}, "AnyEvent::Base"; unshift @ISA, $MODEL; - # now nuke some methods that are overriden by the backend. + # now nuke some methods that are overridden by the backend. # SUPER is not allowed. for (qw(time signal child idle)) { undef &{"AnyEvent::Base::$_"} if defined &{"$MODEL\::$_"}; } - require AnyEvent::Strict if $ENV{PERL_ANYEVENT_STRICT}; + if ($ENV{PERL_ANYEVENT_STRICT}) { + eval { require AnyEvent::Strict }; + warn "AnyEvent: cannot load AnyEvent::Strict: $@" + if $@ && $VERBOSE; + } (shift @post_detect)->() while @post_detect; @@ -1626,7 +1618,6 @@ our %PID_CB; our $CHLD_W; our $CHLD_DELAY_W; -our $WNOHANG; # used by many Impl's sub _emit_childstatus($$) { @@ -1643,7 +1634,7 @@ my $pid; AnyEvent->_emit_childstatus ($pid, $?) - while ($pid = waitpid -1, $WNOHANG) > 0; + while ($pid = waitpid -1, WNOHANG) > 0; }; *child = sub { @@ -1654,11 +1645,6 @@ $PID_CB{$pid}{$arg{cb}} = $arg{cb}; - # WNOHANG is almost cetrainly 1 everywhere - $WNOHANG ||= $^O =~ /^(?:openbsd|netbsd|linux|freebsd|cygwin|MSWin32)$/ - ? 1 - : eval { local $SIG{__DIE__}; require POSIX; &POSIX::WNOHANG } || 1; - unless ($CHLD_W) { $CHLD_W = AE::signal CHLD => \&_sigchld; # child could be a zombie already, so make at least one round @@ -1729,6 +1715,12 @@ our @ISA = AnyEvent::CondVar::Base::; +# only to be used for subclassing +sub new { + my $class = shift; + bless AnyEvent->condvar (@_), $class +} + package AnyEvent::CondVar::Base; #use overload @@ -2656,6 +2648,10 @@ =head1 SEE ALSO +Tutorial/Introduction: L. + +FAQ: L. + Utility functions: L. Event modules: L, L, L, L, L, @@ -2671,10 +2667,9 @@ Asynchronous DNS: L. -Coroutine support: L, L, L, -L, +Thread support: L, L, L, L. -Nontrivial usage examples: L, L, +Nontrivial usage examples: L, L, L.