… | |
… | |
169 | |
169 | |
170 | I/O WATCHERS |
170 | I/O WATCHERS |
171 | You can create an I/O watcher by calling the "AnyEvent->io" method with |
171 | You can create an I/O watcher by calling the "AnyEvent->io" method with |
172 | the following mandatory key-value pairs as arguments: |
172 | the following mandatory key-value pairs as arguments: |
173 | |
173 | |
174 | "fh" is the Perl *file handle* (*not* file descriptor) to watch for |
174 | "fh" is the Perl *file handle* (or a naked file descriptor) to watch for |
175 | events (AnyEvent might or might not keep a reference to this file |
175 | events (AnyEvent might or might not keep a reference to this file |
176 | handle). Note that only file handles pointing to things for which |
176 | handle). Note that only file handles pointing to things for which |
177 | non-blocking operation makes sense are allowed. This includes sockets, |
177 | non-blocking operation makes sense are allowed. This includes sockets, |
178 | most character devices, pipes, fifos and so on, but not for example |
178 | most character devices, pipes, fifos and so on, but not for example |
179 | files or block devices. |
179 | files or block devices. |
… | |
… | |
448 | CONDITION VARIABLES |
448 | CONDITION VARIABLES |
449 | If you are familiar with some event loops you will know that all of them |
449 | If you are familiar with some event loops you will know that all of them |
450 | require you to run some blocking "loop", "run" or similar function that |
450 | require you to run some blocking "loop", "run" or similar function that |
451 | will actively watch for new events and call your callbacks. |
451 | will actively watch for new events and call your callbacks. |
452 | |
452 | |
453 | AnyEvent is different, it expects somebody else to run the event loop |
453 | AnyEvent is slightly different: it expects somebody else to run the |
454 | and will only block when necessary (usually when told by the user). |
454 | event loop and will only block when necessary (usually when told by the |
|
|
455 | user). |
455 | |
456 | |
456 | The instrument to do that is called a "condition variable", so called |
457 | The instrument to do that is called a "condition variable", so called |
457 | because they represent a condition that must become true. |
458 | because they represent a condition that must become true. |
458 | |
459 | |
|
|
460 | Now is probably a good time to look at the examples further below. |
|
|
461 | |
459 | Condition variables can be created by calling the "AnyEvent->condvar" |
462 | Condition variables can be created by calling the "AnyEvent->condvar" |
460 | method, usually without arguments. The only argument pair allowed is |
463 | method, usually without arguments. The only argument pair allowed is |
461 | |
|
|
462 | "cb", which specifies a callback to be called when the condition |
464 | "cb", which specifies a callback to be called when the condition |
463 | variable becomes true, with the condition variable as the first argument |
465 | variable becomes true, with the condition variable as the first argument |
464 | (but not the results). |
466 | (but not the results). |
465 | |
467 | |
466 | After creation, the condition variable is "false" until it becomes |
468 | After creation, the condition variable is "false" until it becomes |
… | |
… | |
515 | after => 1, |
517 | after => 1, |
516 | cb => sub { $result_ready->send }, |
518 | cb => sub { $result_ready->send }, |
517 | ); |
519 | ); |
518 | |
520 | |
519 | # this "blocks" (while handling events) till the callback |
521 | # this "blocks" (while handling events) till the callback |
520 | # calls send |
522 | # calls -<send |
521 | $result_ready->recv; |
523 | $result_ready->recv; |
522 | |
524 | |
523 | Example: wait for a timer, but take advantage of the fact that condition |
525 | Example: wait for a timer, but take advantage of the fact that condition |
524 | variables are also code references. |
526 | variables are also callable directly. |
525 | |
527 | |
526 | my $done = AnyEvent->condvar; |
528 | my $done = AnyEvent->condvar; |
527 | my $delay = AnyEvent->timer (after => 5, cb => $done); |
529 | my $delay = AnyEvent->timer (after => 5, cb => $done); |
528 | $done->recv; |
530 | $done->recv; |
529 | |
531 | |
… | |
… | |
535 | |
537 | |
536 | ... |
538 | ... |
537 | |
539 | |
538 | my @info = $couchdb->info->recv; |
540 | my @info = $couchdb->info->recv; |
539 | |
541 | |
540 | And this is how you would just ste a callback to be called whenever the |
542 | And this is how you would just set a callback to be called whenever the |
541 | results are available: |
543 | results are available: |
542 | |
544 | |
543 | $couchdb->info->cb (sub { |
545 | $couchdb->info->cb (sub { |
544 | my @info = $_[0]->recv; |
546 | my @info = $_[0]->recv; |
545 | }); |
547 | }); |
… | |
… | |
560 | |
562 | |
561 | Any arguments passed to the "send" call will be returned by all |
563 | Any arguments passed to the "send" call will be returned by all |
562 | future "->recv" calls. |
564 | future "->recv" calls. |
563 | |
565 | |
564 | Condition variables are overloaded so one can call them directly (as |
566 | Condition variables are overloaded so one can call them directly (as |
565 | a code reference). Calling them directly is the same as calling |
567 | if they were a code reference). Calling them directly is the same as |
566 | "send". Note, however, that many C-based event loops do not handle |
568 | calling "send". |
567 | overloading, so as tempting as it may be, passing a condition |
|
|
568 | variable instead of a callback does not work. Both the pure perl and |
|
|
569 | EV loops support overloading, however, as well as all functions that |
|
|
570 | use perl to invoke a callback (as in AnyEvent::Socket and |
|
|
571 | AnyEvent::DNS for example). |
|
|
572 | |
569 | |
573 | $cv->croak ($error) |
570 | $cv->croak ($error) |
574 | Similar to send, but causes all call's to "->recv" to invoke |
571 | Similar to send, but causes all call's to "->recv" to invoke |
575 | "Carp::croak" with the given error message/object/scalar. |
572 | "Carp::croak" with the given error message/object/scalar. |
576 | |
573 | |
577 | This can be used to signal any errors to the condition variable |
574 | This can be used to signal any errors to the condition variable |
578 | user/consumer. |
575 | user/consumer. Doing it this way instead of calling "croak" directly |
|
|
576 | delays the error detetcion, but has the overwhelmign advantage that |
|
|
577 | it diagnoses the error at the place where the result is expected, |
|
|
578 | and not deep in some event clalback without connection to the actual |
|
|
579 | code causing the problem. |
579 | |
580 | |
580 | $cv->begin ([group callback]) |
581 | $cv->begin ([group callback]) |
581 | $cv->end |
582 | $cv->end |
582 | These two methods can be used to combine many transactions/events |
583 | These two methods can be used to combine many transactions/events |
583 | into one. For example, a function that pings many hosts in parallel |
584 | into one. For example, a function that pings many hosts in parallel |
… | |
… | |
671 | function will call "croak". |
672 | function will call "croak". |
672 | |
673 | |
673 | In list context, all parameters passed to "send" will be returned, |
674 | In list context, all parameters passed to "send" will be returned, |
674 | in scalar context only the first one will be returned. |
675 | in scalar context only the first one will be returned. |
675 | |
676 | |
|
|
677 | Note that doing a blocking wait in a callback is not supported by |
|
|
678 | any event loop, that is, recursive invocation of a blocking "->recv" |
|
|
679 | is not allowed, and the "recv" call will "croak" if such a condition |
|
|
680 | is detected. This condition can be slightly loosened by using |
|
|
681 | Coro::AnyEvent, which allows you to do a blocking "->recv" from any |
|
|
682 | thread that doesn't run the event loop itself. |
|
|
683 | |
676 | Not all event models support a blocking wait - some die in that case |
684 | Not all event models support a blocking wait - some die in that case |
677 | (programs might want to do that to stay interactive), so *if you are |
685 | (programs might want to do that to stay interactive), so *if you are |
678 | using this from a module, never require a blocking wait*, but let |
686 | using this from a module, never require a blocking wait*. Instead, |
679 | the caller decide whether the call will block or not (for example, |
687 | let the caller decide whether the call will block or not (for |
680 | by coupling condition variables with some kind of request results |
688 | example, by coupling condition variables with some kind of request |
681 | and supporting callbacks so the caller knows that getting the result |
689 | results and supporting callbacks so the caller knows that getting |
682 | will not block, while still supporting blocking waits if the caller |
690 | the result will not block, while still supporting blocking waits if |
683 | so desires). |
691 | the caller so desires). |
684 | |
|
|
685 | Another reason *never* to "->recv" in a module is that you cannot |
|
|
686 | sensibly have two "->recv"'s in parallel, as that would require |
|
|
687 | multiple interpreters or coroutines/threads, none of which |
|
|
688 | "AnyEvent" can supply. |
|
|
689 | |
|
|
690 | The Coro module, however, *can* and *does* supply coroutines and, in |
|
|
691 | fact, Coro::AnyEvent replaces AnyEvent's condvars by coroutine-safe |
|
|
692 | versions and also integrates coroutines into AnyEvent, making |
|
|
693 | blocking "->recv" calls perfectly safe as long as they are done from |
|
|
694 | another coroutine (one that doesn't run the event loop). |
|
|
695 | |
692 | |
696 | You can ensure that "-recv" never blocks by setting a callback and |
693 | You can ensure that "-recv" never blocks by setting a callback and |
697 | only calling "->recv" from within that callback (or at a later |
694 | only calling "->recv" from within that callback (or at a later |
698 | time). This will work even when the event loop does not support |
695 | time). This will work even when the event loop does not support |
699 | blocking waits otherwise. |
696 | blocking waits otherwise. |
… | |
… | |
709 | The callback will be called when the condition becomes "true", i.e. |
706 | The callback will be called when the condition becomes "true", i.e. |
710 | when "send" or "croak" are called, with the only argument being the |
707 | when "send" or "croak" are called, with the only argument being the |
711 | condition variable itself. Calling "recv" inside the callback or at |
708 | condition variable itself. Calling "recv" inside the callback or at |
712 | any later time is guaranteed not to block. |
709 | any later time is guaranteed not to block. |
713 | |
710 | |
|
|
711 | SUPPORTED EVENT LOOPS/BACKENDS |
|
|
712 | The available backend classes are (every class has its own manpage): |
|
|
713 | |
|
|
714 | Backends that are autoprobed when no other event loop can be found. |
|
|
715 | EV is the preferred backend when no other event loop seems to be in |
|
|
716 | use. If EV is not installed, then AnyEvent will try Event, and, |
|
|
717 | failing that, will fall back to its own pure-perl implementation, |
|
|
718 | which is available everywhere as it comes with AnyEvent itself. |
|
|
719 | |
|
|
720 | AnyEvent::Impl::EV based on EV (interface to libev, best choice). |
|
|
721 | AnyEvent::Impl::Event based on Event, very stable, few glitches. |
|
|
722 | AnyEvent::Impl::Perl pure-perl implementation, fast and portable. |
|
|
723 | |
|
|
724 | Backends that are transparently being picked up when they are used. |
|
|
725 | These will be used when they are currently loaded when the first |
|
|
726 | watcher is created, in which case it is assumed that the application |
|
|
727 | is using them. This means that AnyEvent will automatically pick the |
|
|
728 | right backend when the main program loads an event module before |
|
|
729 | anything starts to create watchers. Nothing special needs to be done |
|
|
730 | by the main program. |
|
|
731 | |
|
|
732 | AnyEvent::Impl::Glib based on Glib, slow but very stable. |
|
|
733 | AnyEvent::Impl::Tk based on Tk, very broken. |
|
|
734 | AnyEvent::Impl::EventLib based on Event::Lib, leaks memory and worse. |
|
|
735 | AnyEvent::Impl::POE based on POE, very slow, some limitations. |
|
|
736 | |
|
|
737 | Backends with special needs. |
|
|
738 | Qt requires the Qt::Application to be instantiated first, but will |
|
|
739 | otherwise be picked up automatically. As long as the main program |
|
|
740 | instantiates the application before any AnyEvent watchers are |
|
|
741 | created, everything should just work. |
|
|
742 | |
|
|
743 | AnyEvent::Impl::Qt based on Qt. |
|
|
744 | |
|
|
745 | Support for IO::Async can only be partial, as it is too broken and |
|
|
746 | architecturally limited to even support the AnyEvent API. It also is |
|
|
747 | the only event loop that needs the loop to be set explicitly, so it |
|
|
748 | can only be used by a main program knowing about AnyEvent. See |
|
|
749 | AnyEvent::Impl::Async for the gory details. |
|
|
750 | |
|
|
751 | AnyEvent::Impl::IOAsync based on IO::Async, cannot be autoprobed. |
|
|
752 | |
|
|
753 | Event loops that are indirectly supported via other backends. |
|
|
754 | Some event loops can be supported via other modules: |
|
|
755 | |
|
|
756 | There is no direct support for WxWidgets (Wx) or Prima. |
|
|
757 | |
|
|
758 | WxWidgets has no support for watching file handles. However, you can |
|
|
759 | use WxWidgets through the POE adaptor, as POE has a Wx backend that |
|
|
760 | simply polls 20 times per second, which was considered to be too |
|
|
761 | horrible to even consider for AnyEvent. |
|
|
762 | |
|
|
763 | Prima is not supported as nobody seems to be using it, but it has a |
|
|
764 | POE backend, so it can be supported through POE. |
|
|
765 | |
|
|
766 | AnyEvent knows about both Prima and Wx, however, and will try to |
|
|
767 | load POE when detecting them, in the hope that POE will pick them |
|
|
768 | up, in which case everything will be automatic. |
|
|
769 | |
714 | GLOBAL VARIABLES AND FUNCTIONS |
770 | GLOBAL VARIABLES AND FUNCTIONS |
|
|
771 | These are not normally required to use AnyEvent, but can be useful to |
|
|
772 | write AnyEvent extension modules. |
|
|
773 | |
715 | $AnyEvent::MODEL |
774 | $AnyEvent::MODEL |
716 | Contains "undef" until the first watcher is being created. Then it |
775 | Contains "undef" until the first watcher is being created, before |
|
|
776 | the backend has been autodetected. |
|
|
777 | |
717 | contains the event model that is being used, which is the name of |
778 | Afterwards it contains the event model that is being used, which is |
718 | the Perl class implementing the model. This class is usually one of |
779 | the name of the Perl class implementing the model. This class is |
719 | the "AnyEvent::Impl:xxx" modules, but can be any other class in the |
780 | usually one of the "AnyEvent::Impl:xxx" modules, but can be any |
720 | case AnyEvent has been extended at runtime (e.g. in *rxvt-unicode*). |
781 | other class in the case AnyEvent has been extended at runtime (e.g. |
721 | |
782 | in *rxvt-unicode* it will be "urxvt::anyevent"). |
722 | The known classes so far are: |
|
|
723 | |
|
|
724 | AnyEvent::Impl::EV based on EV (an interface to libev, best choice). |
|
|
725 | AnyEvent::Impl::Event based on Event, second best choice. |
|
|
726 | AnyEvent::Impl::Perl pure-perl implementation, fast and portable. |
|
|
727 | AnyEvent::Impl::Glib based on Glib, third-best choice. |
|
|
728 | AnyEvent::Impl::Tk based on Tk, very bad choice. |
|
|
729 | AnyEvent::Impl::Qt based on Qt, cannot be autoprobed (see its docs). |
|
|
730 | AnyEvent::Impl::EventLib based on Event::Lib, leaks memory and worse. |
|
|
731 | AnyEvent::Impl::POE based on POE, not generic enough for full support. |
|
|
732 | |
|
|
733 | # warning, support for IO::Async is only partial, as it is too broken |
|
|
734 | # and limited toe ven support the AnyEvent API. See AnyEvent::Impl::Async. |
|
|
735 | AnyEvent::Impl::IOAsync based on IO::Async, cannot be autoprobed (see its docs). |
|
|
736 | |
|
|
737 | There is no support for WxWidgets, as WxWidgets has no support for |
|
|
738 | watching file handles. However, you can use WxWidgets through the |
|
|
739 | POE Adaptor, as POE has a Wx backend that simply polls 20 times per |
|
|
740 | second, which was considered to be too horrible to even consider for |
|
|
741 | AnyEvent. Likewise, other POE backends can be used by AnyEvent by |
|
|
742 | using it's adaptor. |
|
|
743 | |
|
|
744 | AnyEvent knows about Prima and Wx and will try to use POE when |
|
|
745 | autodetecting them. |
|
|
746 | |
783 | |
747 | AnyEvent::detect |
784 | AnyEvent::detect |
748 | Returns $AnyEvent::MODEL, forcing autodetection of the event model |
785 | Returns $AnyEvent::MODEL, forcing autodetection of the event model |
749 | if necessary. You should only call this function right before you |
786 | if necessary. You should only call this function right before you |
750 | would have created an AnyEvent watcher anyway, that is, as late as |
787 | would have created an AnyEvent watcher anyway, that is, as late as |
751 | possible at runtime. |
788 | possible at runtime, and not e.g. while initialising of your module. |
|
|
789 | |
|
|
790 | If you need to do some initialisation before AnyEvent watchers are |
|
|
791 | created, use "post_detect". |
752 | |
792 | |
753 | $guard = AnyEvent::post_detect { BLOCK } |
793 | $guard = AnyEvent::post_detect { BLOCK } |
754 | Arranges for the code block to be executed as soon as the event |
794 | Arranges for the code block to be executed as soon as the event |
755 | model is autodetected (or immediately if this has already happened). |
795 | model is autodetected (or immediately if this has already happened). |
|
|
796 | |
|
|
797 | The block will be executed *after* the actual backend has been |
|
|
798 | detected ($AnyEvent::MODEL is set), but *before* any watchers have |
|
|
799 | been created, so it is possible to e.g. patch @AnyEvent::ISA or do |
|
|
800 | other initialisations - see the sources of AnyEvent::Strict or |
|
|
801 | AnyEvent::AIO to see how this is used. |
|
|
802 | |
|
|
803 | The most common usage is to create some global watchers, without |
|
|
804 | forcing event module detection too early, for example, AnyEvent::AIO |
|
|
805 | creates and installs the global IO::AIO watcher in a "post_detect" |
|
|
806 | block to avoid autodetecting the event module at load time. |
756 | |
807 | |
757 | If called in scalar or list context, then it creates and returns an |
808 | If called in scalar or list context, then it creates and returns an |
758 | object that automatically removes the callback again when it is |
809 | object that automatically removes the callback again when it is |
759 | destroyed. See Coro::BDB for a case where this is useful. |
810 | destroyed. See Coro::BDB for a case where this is useful. |
760 | |
811 | |
… | |
… | |
762 | If there are any code references in this array (you can "push" to it |
813 | If there are any code references in this array (you can "push" to it |
763 | before or after loading AnyEvent), then they will called directly |
814 | before or after loading AnyEvent), then they will called directly |
764 | after the event loop has been chosen. |
815 | after the event loop has been chosen. |
765 | |
816 | |
766 | You should check $AnyEvent::MODEL before adding to this array, |
817 | You should check $AnyEvent::MODEL before adding to this array, |
767 | though: if it contains a true value then the event loop has already |
818 | though: if it is defined then the event loop has already been |
768 | been detected, and the array will be ignored. |
819 | detected, and the array will be ignored. |
769 | |
820 | |
770 | Best use "AnyEvent::post_detect { BLOCK }" instead. |
821 | Best use "AnyEvent::post_detect { BLOCK }" when your application |
|
|
822 | allows it,as it takes care of these details. |
|
|
823 | |
|
|
824 | This variable is mainly useful for modules that can do something |
|
|
825 | useful when AnyEvent is used and thus want to know when it is |
|
|
826 | initialised, but do not need to even load it by default. This array |
|
|
827 | provides the means to hook into AnyEvent passively, without loading |
|
|
828 | it. |
771 | |
829 | |
772 | WHAT TO DO IN A MODULE |
830 | WHAT TO DO IN A MODULE |
773 | As a module author, you should "use AnyEvent" and call AnyEvent methods |
831 | As a module author, you should "use AnyEvent" and call AnyEvent methods |
774 | freely, but you should not load a specific event module or rely on it. |
832 | freely, but you should not load a specific event module or rely on it. |
775 | |
833 | |
… | |
… | |
826 | variable somewhere, waiting for it, and sending it when the program |
884 | variable somewhere, waiting for it, and sending it when the program |
827 | should exit cleanly. |
885 | should exit cleanly. |
828 | |
886 | |
829 | OTHER MODULES |
887 | OTHER MODULES |
830 | The following is a non-exhaustive list of additional modules that use |
888 | The following is a non-exhaustive list of additional modules that use |
831 | AnyEvent and can therefore be mixed easily with other AnyEvent modules |
889 | AnyEvent as a client and can therefore be mixed easily with other |
832 | in the same program. Some of the modules come with AnyEvent, some are |
890 | AnyEvent modules and other event loops in the same program. Some of the |
833 | available via CPAN. |
891 | modules come with AnyEvent, most are available via CPAN. |
834 | |
892 | |
835 | AnyEvent::Util |
893 | AnyEvent::Util |
836 | Contains various utility functions that replace often-used but |
894 | Contains various utility functions that replace often-used but |
837 | blocking functions such as "inet_aton" by event-/callback-based |
895 | blocking functions such as "inet_aton" by event-/callback-based |
838 | versions. |
896 | versions. |
… | |
… | |
844 | more. |
902 | more. |
845 | |
903 | |
846 | AnyEvent::Handle |
904 | AnyEvent::Handle |
847 | Provide read and write buffers, manages watchers for reads and |
905 | Provide read and write buffers, manages watchers for reads and |
848 | writes, supports raw and formatted I/O, I/O queued and fully |
906 | writes, supports raw and formatted I/O, I/O queued and fully |
849 | transparent and non-blocking SSL/TLS. |
907 | transparent and non-blocking SSL/TLS (via AnyEvent::TLS. |
850 | |
908 | |
851 | AnyEvent::DNS |
909 | AnyEvent::DNS |
852 | Provides rich asynchronous DNS resolver capabilities. |
910 | Provides rich asynchronous DNS resolver capabilities. |
853 | |
911 | |
854 | AnyEvent::HTTP |
912 | AnyEvent::HTTP |
… | |
… | |
875 | |
933 | |
876 | AnyEvent::GPSD |
934 | AnyEvent::GPSD |
877 | A non-blocking interface to gpsd, a daemon delivering GPS |
935 | A non-blocking interface to gpsd, a daemon delivering GPS |
878 | information. |
936 | information. |
879 | |
937 | |
|
|
938 | AnyEvent::IRC |
|
|
939 | AnyEvent based IRC client module family (replacing the older |
|
|
940 | Net::IRC3). |
|
|
941 | |
|
|
942 | AnyEvent::XMPP |
|
|
943 | AnyEvent based XMPP (Jabber protocol) module family (replacing the |
|
|
944 | older Net::XMPP2>. |
|
|
945 | |
880 | AnyEvent::IGS |
946 | AnyEvent::IGS |
881 | A non-blocking interface to the Internet Go Server protocol (used by |
947 | A non-blocking interface to the Internet Go Server protocol (used by |
882 | App::IGS). |
948 | App::IGS). |
883 | |
949 | |
884 | AnyEvent::IRC |
|
|
885 | AnyEvent based IRC client module family (replacing the older |
|
|
886 | Net::IRC3). |
|
|
887 | |
|
|
888 | Net::XMPP2 |
|
|
889 | AnyEvent based XMPP (Jabber protocol) module family. |
|
|
890 | |
|
|
891 | Net::FCP |
950 | Net::FCP |
892 | AnyEvent-based implementation of the Freenet Client Protocol, |
951 | AnyEvent-based implementation of the Freenet Client Protocol, |
893 | birthplace of AnyEvent. |
952 | birthplace of AnyEvent. |
894 | |
953 | |
895 | Event::ExecFlow |
954 | Event::ExecFlow |
896 | High level API for event-based execution flow control. |
955 | High level API for event-based execution flow control. |
897 | |
956 | |
898 | Coro |
957 | Coro |
899 | Has special support for AnyEvent via Coro::AnyEvent. |
958 | Has special support for AnyEvent via Coro::AnyEvent. |
900 | |
|
|
901 | IO::Lambda |
|
|
902 | The lambda approach to I/O - don't ask, look there. Can use |
|
|
903 | AnyEvent. |
|
|
904 | |
959 | |
905 | ERROR AND EXCEPTION HANDLING |
960 | ERROR AND EXCEPTION HANDLING |
906 | In general, AnyEvent does not do any error handling - it relies on the |
961 | In general, AnyEvent does not do any error handling - it relies on the |
907 | caller to do that if required. The AnyEvent::Strict module (see also the |
962 | caller to do that if required. The AnyEvent::Strict module (see also the |
908 | "PERL_ANYEVENT_STRICT" environment variable, below) provides strict |
963 | "PERL_ANYEVENT_STRICT" environment variable, below) provides strict |
… | |
… | |
998 | EDNS0 in its DNS requests. |
1053 | EDNS0 in its DNS requests. |
999 | |
1054 | |
1000 | "PERL_ANYEVENT_MAX_FORKS" |
1055 | "PERL_ANYEVENT_MAX_FORKS" |
1001 | The maximum number of child processes that |
1056 | The maximum number of child processes that |
1002 | "AnyEvent::Util::fork_call" will create in parallel. |
1057 | "AnyEvent::Util::fork_call" will create in parallel. |
|
|
1058 | |
|
|
1059 | "PERL_ANYEVENT_MAX_OUTSTANDING_DNS" |
|
|
1060 | The default value for the "max_outstanding" parameter for the |
|
|
1061 | default DNS resolver - this is the maximum number of parallel DNS |
|
|
1062 | requests that are sent to the DNS server. |
|
|
1063 | |
|
|
1064 | "PERL_ANYEVENT_RESOLV_CONF" |
|
|
1065 | The file to use instead of /etc/resolv.conf (or OS-specific |
|
|
1066 | configuration) in the default resolver. When set to the empty |
|
|
1067 | string, no default config will be used. |
|
|
1068 | |
|
|
1069 | "PERL_ANYEVENT_CA_FILE", "PERL_ANYEVENT_CA_PATH". |
|
|
1070 | When neither "ca_file" nor "ca_path" was specified during |
|
|
1071 | AnyEvent::TLS context creation, and either of these environment |
|
|
1072 | variables exist, they will be used to specify CA certificate |
|
|
1073 | locations instead of a system-dependent default. |
1003 | |
1074 | |
1004 | SUPPLYING YOUR OWN EVENT MODEL INTERFACE |
1075 | SUPPLYING YOUR OWN EVENT MODEL INTERFACE |
1005 | This is an advanced topic that you do not normally need to use AnyEvent |
1076 | This is an advanced topic that you do not normally need to use AnyEvent |
1006 | in a module. This section is only of use to event loop authors who want |
1077 | in a module. This section is only of use to event loop authors who want |
1007 | to provide AnyEvent compatibility. |
1078 | to provide AnyEvent compatibility. |
… | |
… | |
1512 | SIGCHLD |
1583 | SIGCHLD |
1513 | A handler for "SIGCHLD" is installed by AnyEvent's child watcher |
1584 | A handler for "SIGCHLD" is installed by AnyEvent's child watcher |
1514 | emulation for event loops that do not support them natively. Also, |
1585 | emulation for event loops that do not support them natively. Also, |
1515 | some event loops install a similar handler. |
1586 | some event loops install a similar handler. |
1516 | |
1587 | |
1517 | If, when AnyEvent is loaded, SIGCHLD is set to IGNORE, then AnyEvent |
1588 | Additionally, when AnyEvent is loaded and SIGCHLD is set to IGNORE, |
1518 | will reset it to default, to avoid losing child exit statuses. |
1589 | then AnyEvent will reset it to default, to avoid losing child exit |
|
|
1590 | statuses. |
1519 | |
1591 | |
1520 | SIGPIPE |
1592 | SIGPIPE |
1521 | A no-op handler is installed for "SIGPIPE" when $SIG{PIPE} is |
1593 | A no-op handler is installed for "SIGPIPE" when $SIG{PIPE} is |
1522 | "undef" when AnyEvent gets loaded. |
1594 | "undef" when AnyEvent gets loaded. |
1523 | |
1595 | |
… | |
… | |
1578 | Event modules: EV, EV::Glib, Glib::EV, Event, Glib::Event, Glib, Tk, |
1650 | Event modules: EV, EV::Glib, Glib::EV, Event, Glib::Event, Glib, Tk, |
1579 | Event::Lib, Qt, POE. |
1651 | Event::Lib, Qt, POE. |
1580 | |
1652 | |
1581 | Implementations: AnyEvent::Impl::EV, AnyEvent::Impl::Event, |
1653 | Implementations: AnyEvent::Impl::EV, AnyEvent::Impl::Event, |
1582 | AnyEvent::Impl::Glib, AnyEvent::Impl::Tk, AnyEvent::Impl::Perl, |
1654 | AnyEvent::Impl::Glib, AnyEvent::Impl::Tk, AnyEvent::Impl::Perl, |
1583 | AnyEvent::Impl::EventLib, AnyEvent::Impl::Qt, AnyEvent::Impl::POE. |
1655 | AnyEvent::Impl::EventLib, AnyEvent::Impl::Qt, AnyEvent::Impl::POE, |
|
|
1656 | AnyEvent::Impl::IOAsync. |
1584 | |
1657 | |
1585 | Non-blocking file handles, sockets, TCP clients and servers: |
1658 | Non-blocking file handles, sockets, TCP clients and servers: |
1586 | AnyEvent::Handle, AnyEvent::Socket. |
1659 | AnyEvent::Handle, AnyEvent::Socket, AnyEvent::TLS. |
1587 | |
1660 | |
1588 | Asynchronous DNS: AnyEvent::DNS. |
1661 | Asynchronous DNS: AnyEvent::DNS. |
1589 | |
1662 | |
1590 | Coroutine support: Coro, Coro::AnyEvent, Coro::EV, Coro::Event, |
1663 | Coroutine support: Coro, Coro::AnyEvent, Coro::EV, Coro::Event, |
1591 | |
1664 | |
1592 | Nontrivial usage examples: Net::FCP, Net::XMPP2, AnyEvent::DNS. |
1665 | Nontrivial usage examples: AnyEvent::GPSD, AnyEvent::XMPP, |
|
|
1666 | AnyEvent::HTTP. |
1593 | |
1667 | |
1594 | AUTHOR |
1668 | AUTHOR |
1595 | Marc Lehmann <schmorp@schmorp.de> |
1669 | Marc Lehmann <schmorp@schmorp.de> |
1596 | http://home.schmorp.de/ |
1670 | http://home.schmorp.de/ |
1597 | |
1671 | |