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

Comparing AnyEvent/lib/AnyEvent.pm (file contents):
Revision 1.231 by root, Wed Jul 8 13:46:46 2009 UTC vs.
Revision 1.232 by root, Thu Jul 9 01:08:22 2009 UTC

740variable itself. Calling C<recv> inside the callback or at any later time 740variable itself. Calling C<recv> inside the callback or at any later time
741is guaranteed not to block. 741is guaranteed not to block.
742 742
743=back 743=back
744 744
745=head1 SUPPORTED EVENT LOOPS/BACKENDS
746
747The available backend classes are (every class has its own manpage):
748
749=over 4
750
751=item Backends that are autoprobed when no other event loop can be found.
752
753EV is the preferred backend when no other event loop seems to be in
754use. If EV is not installed, then AnyEvent will try Event, and, failing
755that, will fall back to its own pure-perl implementation, which is
756available everywhere as it comes with AnyEvent itself.
757
758 AnyEvent::Impl::EV based on EV (interface to libev, best choice).
759 AnyEvent::Impl::Event based on Event, very stable, few glitches.
760 AnyEvent::Impl::Perl pure-perl implementation, fast and portable.
761
762=item Backends that are transparently being picked up when they are used.
763
764These will be used when they are currently loaded when the first watcher
765is created, in which case it is assumed that the application is using
766them. This means that AnyEvent will automatically pick the right backend
767when the main program loads an event module before anything starts to
768create watchers. Nothing special needs to be done by the main program.
769
770 AnyEvent::Impl::Glib based on Glib, slow but very stable.
771 AnyEvent::Impl::Tk based on Tk, very broken.
772 AnyEvent::Impl::EventLib based on Event::Lib, leaks memory and worse.
773 AnyEvent::Impl::POE based on POE, very slow, some limitations.
774
775=item Backends with special needs.
776
777Qt requires the Qt::Application to be instantiated first, but will
778otherwise be picked up automatically. As long as the main program
779instantiates the application before any AnyEvent watchers are created,
780everything should just work.
781
782 AnyEvent::Impl::Qt based on Qt.
783
784Support for IO::Async can only be partial, as it is too broken and
785architecturally limited to even support the AnyEvent API. It also
786is the only event loop that needs the loop to be set explicitly, so
787it can only be used by a main program knowing about AnyEvent. See
788L<AnyEvent::Impl::Async> for the gory details.
789
790 AnyEvent::Impl::IOAsync based on IO::Async, cannot be autoprobed.
791
792=item Event loops that are indirectly supported via other backends.
793
794Some event loops can be supported via other modules:
795
796There is no direct support for WxWidgets (L<Wx>) or L<Prima>.
797
798B<WxWidgets> has no support for watching file handles. However, you can
799use WxWidgets through the POE adaptor, as POE has a Wx backend that simply
800polls 20 times per second, which was considered to be too horrible to even
801consider for AnyEvent.
802
803B<Prima> is not supported as nobody seems to be using it, but it has a POE
804backend, so it can be supported through POE.
805
806AnyEvent knows about both L<Prima> and L<Wx>, however, and will try to
807load L<POE> when detecting them, in the hope that POE will pick them up,
808in which case everything will be automatic.
809
810=back
811
745=head1 GLOBAL VARIABLES AND FUNCTIONS 812=head1 GLOBAL VARIABLES AND FUNCTIONS
746 813
747=over 4 814=over 4
748 815
749=item $AnyEvent::MODEL 816=item $AnyEvent::MODEL
751Contains C<undef> until the first watcher is being created. Then it 818Contains C<undef> until the first watcher is being created. Then it
752contains the event model that is being used, which is the name of the 819contains the event model that is being used, which is the name of the
753Perl class implementing the model. This class is usually one of the 820Perl class implementing the model. This class is usually one of the
754C<AnyEvent::Impl:xxx> modules, but can be any other class in the case 821C<AnyEvent::Impl:xxx> modules, but can be any other class in the case
755AnyEvent has been extended at runtime (e.g. in I<rxvt-unicode>). 822AnyEvent has been extended at runtime (e.g. in I<rxvt-unicode>).
756
757The known classes so far are:
758
759 AnyEvent::Impl::EV based on EV (an interface to libev, best choice).
760 AnyEvent::Impl::Event based on Event, second best choice.
761 AnyEvent::Impl::Perl pure-perl implementation, fast and portable.
762 AnyEvent::Impl::Glib based on Glib, third-best choice.
763 AnyEvent::Impl::Tk based on Tk, very bad choice.
764 AnyEvent::Impl::Qt based on Qt, cannot be autoprobed (see its docs).
765 AnyEvent::Impl::EventLib based on Event::Lib, leaks memory and worse.
766 AnyEvent::Impl::POE based on POE, not generic enough for full support.
767
768 # warning, support for IO::Async is only partial, as it is too broken
769 # and limited toe ven support the AnyEvent API. See AnyEvent::Impl::Async.
770 AnyEvent::Impl::IOAsync based on IO::Async, cannot be autoprobed (see its docs).
771
772There is no support for WxWidgets, as WxWidgets has no support for
773watching file handles. However, you can use WxWidgets through the
774POE Adaptor, as POE has a Wx backend that simply polls 20 times per
775second, which was considered to be too horrible to even consider for
776AnyEvent. Likewise, other POE backends can be used by AnyEvent by using
777it's adaptor.
778
779AnyEvent knows about L<Prima> and L<Wx> and will try to use L<POE> when
780autodetecting them.
781 823
782=item AnyEvent::detect 824=item AnyEvent::detect
783 825
784Returns C<$AnyEvent::MODEL>, forcing autodetection of the event model 826Returns C<$AnyEvent::MODEL>, forcing autodetection of the event model
785if necessary. You should only call this function right before you would 827if necessary. You should only call this function right before you would
1001 [Event:: => AnyEvent::Impl::Event::], 1043 [Event:: => AnyEvent::Impl::Event::],
1002 [AnyEvent::Impl::Perl:: => AnyEvent::Impl::Perl::], 1044 [AnyEvent::Impl::Perl:: => AnyEvent::Impl::Perl::],
1003 # everything below here will not be autoprobed 1045 # everything below here will not be autoprobed
1004 # as the pureperl backend should work everywhere 1046 # as the pureperl backend should work everywhere
1005 # and is usually faster 1047 # and is usually faster
1006 [Tk:: => AnyEvent::Impl::Tk::], # crashes with many handles
1007 [Glib:: => AnyEvent::Impl::Glib::], # becomes extremely slow with many watchers 1048 [Glib:: => AnyEvent::Impl::Glib::], # becomes extremely slow with many watchers
1008 [Event::Lib:: => AnyEvent::Impl::EventLib::], # too buggy 1049 [Event::Lib:: => AnyEvent::Impl::EventLib::], # too buggy
1050 [Tk:: => AnyEvent::Impl::Tk::], # crashes with many handles
1051 [POE::Kernel:: => AnyEvent::Impl::POE::], # lasciate ogni speranza
1009 [Qt:: => AnyEvent::Impl::Qt::], # requires special main program 1052 [Qt:: => AnyEvent::Impl::Qt::], # requires special main program
1010 [POE::Kernel:: => AnyEvent::Impl::POE::], # lasciate ogni speranza
1011 [Wx:: => AnyEvent::Impl::POE::], 1053 [Wx:: => AnyEvent::Impl::POE::],
1012 [Prima:: => AnyEvent::Impl::POE::], 1054 [Prima:: => AnyEvent::Impl::POE::],
1013 # IO::Async is just too broken - we would need workaorunds for its 1055 # IO::Async is just too broken - we would need workarounds for its
1014 # byzantine signal and broken child handling, among others. 1056 # byzantine signal and broken child handling, among others.
1015 # IO::Async is rather hard to detect, as it doesn't have any 1057 # IO::Async is rather hard to detect, as it doesn't have any
1016 # obvious default class. 1058 # obvious default class.
1017# [IO::Async:: => AnyEvent::Impl::IOAsync::], # requires special main program 1059# [IO::Async:: => AnyEvent::Impl::IOAsync::], # requires special main program
1018# [IO::Async::Loop:: => AnyEvent::Impl::IOAsync::], # requires special main program 1060# [IO::Async::Loop:: => AnyEvent::Impl::IOAsync::], # requires special main program

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines