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

Comparing AnyEvent/README (file contents):
Revision 1.41 by root, Fri Jun 26 06:33:17 2009 UTC vs.
Revision 1.45 by root, Fri Jul 17 14:57:03 2009 UTC

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 are EXPERIMENTAL and MIGHT CHANGE.
583
584 These two methods can be used to combine many transactions/events 583 These two methods can be used to combine many transactions/events
585 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
586 might want to use a condition variable for the whole process. 585 might want to use a condition variable for the whole process.
587 586
588 Every call to "->begin" will increment a counter, and every call to 587 Every call to "->begin" will increment a counter, and every call to
589 "->end" will decrement it. If the counter reaches 0 in "->end", the 588 "->end" will decrement it. If the counter reaches 0 in "->end", the
590 (last) callback passed to "begin" will be executed. That callback is 589 (last) callback passed to "begin" will be executed. That callback is
591 *supposed* to call "->send", but that is not required. If no 590 *supposed* to call "->send", but that is not required. If no
592 callback was set, "send" will be called without any arguments. 591 callback was set, "send" will be called without any arguments.
593 592
594 Let's clarify this with the ping example: 593 You can think of "$cv->send" giving you an OR condition (one call
594 sends), while "$cv->begin" and "$cv->end" giving you an AND
595 condition (all "begin" calls must be "end"'ed before the condvar
596 sends).
597
598 Let's start with a simple example: you have two I/O watchers (for
599 example, STDOUT and STDERR for a program), and you want to wait for
600 both streams to close before activating a condvar:
601
602 my $cv = AnyEvent->condvar;
603
604 $cv->begin; # first watcher
605 my $w1 = AnyEvent->io (fh => $fh1, cb => sub {
606 defined sysread $fh1, my $buf, 4096
607 or $cv->end;
608 });
609
610 $cv->begin; # second watcher
611 my $w2 = AnyEvent->io (fh => $fh2, cb => sub {
612 defined sysread $fh2, my $buf, 4096
613 or $cv->end;
614 });
615
616 $cv->recv;
617
618 This works because for every event source (EOF on file handle),
619 there is one call to "begin", so the condvar waits for all calls to
620 "end" before sending.
621
622 The ping example mentioned above is slightly more complicated, as
623 the there are results to be passwd back, and the number of tasks
624 that are begung can potentially be zero:
595 625
596 my $cv = AnyEvent->condvar; 626 my $cv = AnyEvent->condvar;
597 627
598 my %result; 628 my %result;
599 $cv->begin (sub { $cv->send (\%result) }); 629 $cv->begin (sub { $cv->send (\%result) });
619 the loop, which serves two important purposes: first, it sets the 649 the loop, which serves two important purposes: first, it sets the
620 callback to be called once the counter reaches 0, and second, it 650 callback to be called once the counter reaches 0, and second, it
621 ensures that "send" is called even when "no" hosts are being pinged 651 ensures that "send" is called even when "no" hosts are being pinged
622 (the loop doesn't execute once). 652 (the loop doesn't execute once).
623 653
624 This is the general pattern when you "fan out" into multiple 654 This is the general pattern when you "fan out" into multiple (but
625 subrequests: use an outer "begin"/"end" pair to set the callback and 655 potentially none) subrequests: use an outer "begin"/"end" pair to
626 ensure "end" is called at least once, and then, for each subrequest 656 set the callback and ensure "end" is called at least once, and then,
627 you start, call "begin" and for each subrequest you finish, call 657 for each subrequest you start, call "begin" and for each subrequest
628 "end". 658 you finish, call "end".
629 659
630 METHODS FOR CONSUMERS 660 METHODS FOR CONSUMERS
631 These methods should only be used by the consuming side, i.e. the code 661 These methods should only be used by the consuming side, i.e. the code
632 awaits the condition. 662 awaits the condition.
633 663
642 function will call "croak". 672 function will call "croak".
643 673
644 In list context, all parameters passed to "send" will be returned, 674 In list context, all parameters passed to "send" will be returned,
645 in scalar context only the first one will be returned. 675 in scalar context only the first one will be returned.
646 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
647 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
648 (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
649 using this from a module, never require a blocking wait*, but let 686 using this from a module, never require a blocking wait*. Instead,
650 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
651 by coupling condition variables with some kind of request results 688 example, by coupling condition variables with some kind of request
652 and supporting callbacks so the caller knows that getting the result 689 results and supporting callbacks so the caller knows that getting
653 will not block, while still supporting blocking waits if the caller 690 the result will not block, while still supporting blocking waits if
654 so desires). 691 the caller so desires).
655
656 Another reason *never* to "->recv" in a module is that you cannot
657 sensibly have two "->recv"'s in parallel, as that would require
658 multiple interpreters or coroutines/threads, none of which
659 "AnyEvent" can supply.
660
661 The Coro module, however, *can* and *does* supply coroutines and, in
662 fact, Coro::AnyEvent replaces AnyEvent's condvars by coroutine-safe
663 versions and also integrates coroutines into AnyEvent, making
664 blocking "->recv" calls perfectly safe as long as they are done from
665 another coroutine (one that doesn't run the event loop).
666 692
667 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
668 only calling "->recv" from within that callback (or at a later 694 only calling "->recv" from within that callback (or at a later
669 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
670 blocking waits otherwise. 696 blocking waits otherwise.
680 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.
681 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
682 condition variable itself. Calling "recv" inside the callback or at 708 condition variable itself. Calling "recv" inside the callback or at
683 any later time is guaranteed not to block. 709 any later time is guaranteed not to block.
684 710
711SUPPORTED 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
685GLOBAL VARIABLES AND FUNCTIONS 770GLOBAL VARIABLES AND FUNCTIONS
771 These are not normally required to use AnyEvent, but can be useful to
772 write AnyEvent extension modules.
773
686 $AnyEvent::MODEL 774 $AnyEvent::MODEL
687 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
688 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
689 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
690 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
691 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.
692 782 in *rxvt-unicode* it will be "urxvt::anyevent").
693 The known classes so far are:
694
695 AnyEvent::Impl::EV based on EV (an interface to libev, best choice).
696 AnyEvent::Impl::Event based on Event, second best choice.
697 AnyEvent::Impl::Perl pure-perl implementation, fast and portable.
698 AnyEvent::Impl::Glib based on Glib, third-best choice.
699 AnyEvent::Impl::Tk based on Tk, very bad choice.
700 AnyEvent::Impl::Qt based on Qt, cannot be autoprobed (see its docs).
701 AnyEvent::Impl::EventLib based on Event::Lib, leaks memory and worse.
702 AnyEvent::Impl::POE based on POE, not generic enough for full support.
703
704 # warning, support for IO::Async is only partial, as it is too broken
705 # and limited toe ven support the AnyEvent API. See AnyEvent::Impl::Async.
706 AnyEvent::Impl::IOAsync based on IO::Async, cannot be autoprobed (see its docs).
707
708 There is no support for WxWidgets, as WxWidgets has no support for
709 watching file handles. However, you can use WxWidgets through the
710 POE Adaptor, as POE has a Wx backend that simply polls 20 times per
711 second, which was considered to be too horrible to even consider for
712 AnyEvent. Likewise, other POE backends can be used by AnyEvent by
713 using it's adaptor.
714
715 AnyEvent knows about Prima and Wx and will try to use POE when
716 autodetecting them.
717 783
718 AnyEvent::detect 784 AnyEvent::detect
719 Returns $AnyEvent::MODEL, forcing autodetection of the event model 785 Returns $AnyEvent::MODEL, forcing autodetection of the event model
720 if necessary. You should only call this function right before you 786 if necessary. You should only call this function right before you
721 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
722 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".
723 792
724 $guard = AnyEvent::post_detect { BLOCK } 793 $guard = AnyEvent::post_detect { BLOCK }
725 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
726 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.
727 807
728 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
729 object that automatically removes the callback again when it is 809 object that automatically removes the callback again when it is
730 destroyed. See Coro::BDB for a case where this is useful. 810 destroyed. See Coro::BDB for a case where this is useful.
731 811
733 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
734 before or after loading AnyEvent), then they will called directly 814 before or after loading AnyEvent), then they will called directly
735 after the event loop has been chosen. 815 after the event loop has been chosen.
736 816
737 You should check $AnyEvent::MODEL before adding to this array, 817 You should check $AnyEvent::MODEL before adding to this array,
738 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
739 been detected, and the array will be ignored. 819 detected, and the array will be ignored.
740 820
741 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.
742 829
743WHAT TO DO IN A MODULE 830WHAT TO DO IN A MODULE
744 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
745 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.
746 833
797 variable somewhere, waiting for it, and sending it when the program 884 variable somewhere, waiting for it, and sending it when the program
798 should exit cleanly. 885 should exit cleanly.
799 886
800OTHER MODULES 887OTHER MODULES
801 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
802 AnyEvent and can therefore be mixed easily with other AnyEvent modules 889 AnyEvent as a client and can therefore be mixed easily with other
803 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
804 available via CPAN. 891 modules come with AnyEvent, most are available via CPAN.
805 892
806 AnyEvent::Util 893 AnyEvent::Util
807 Contains various utility functions that replace often-used but 894 Contains various utility functions that replace often-used but
808 blocking functions such as "inet_aton" by event-/callback-based 895 blocking functions such as "inet_aton" by event-/callback-based
809 versions. 896 versions.
815 more. 902 more.
816 903
817 AnyEvent::Handle 904 AnyEvent::Handle
818 Provide read and write buffers, manages watchers for reads and 905 Provide read and write buffers, manages watchers for reads and
819 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
820 transparent and non-blocking SSL/TLS. 907 transparent and non-blocking SSL/TLS (via AnyEvent::TLS.
821 908
822 AnyEvent::DNS 909 AnyEvent::DNS
823 Provides rich asynchronous DNS resolver capabilities. 910 Provides rich asynchronous DNS resolver capabilities.
824 911
825 AnyEvent::HTTP 912 AnyEvent::HTTP
846 933
847 AnyEvent::GPSD 934 AnyEvent::GPSD
848 A non-blocking interface to gpsd, a daemon delivering GPS 935 A non-blocking interface to gpsd, a daemon delivering GPS
849 information. 936 information.
850 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
851 AnyEvent::IGS 946 AnyEvent::IGS
852 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
853 App::IGS). 948 App::IGS).
854 949
855 AnyEvent::IRC
856 AnyEvent based IRC client module family (replacing the older
857 Net::IRC3).
858
859 Net::XMPP2
860 AnyEvent based XMPP (Jabber protocol) module family.
861
862 Net::FCP 950 Net::FCP
863 AnyEvent-based implementation of the Freenet Client Protocol, 951 AnyEvent-based implementation of the Freenet Client Protocol,
864 birthplace of AnyEvent. 952 birthplace of AnyEvent.
865 953
866 Event::ExecFlow 954 Event::ExecFlow
867 High level API for event-based execution flow control. 955 High level API for event-based execution flow control.
868 956
869 Coro 957 Coro
870 Has special support for AnyEvent via Coro::AnyEvent. 958 Has special support for AnyEvent via Coro::AnyEvent.
871
872 IO::Lambda
873 The lambda approach to I/O - don't ask, look there. Can use
874 AnyEvent.
875 959
876ERROR AND EXCEPTION HANDLING 960ERROR AND EXCEPTION HANDLING
877 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
878 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
879 "PERL_ANYEVENT_STRICT" environment variable, below) provides strict 963 "PERL_ANYEVENT_STRICT" environment variable, below) provides strict
969 EDNS0 in its DNS requests. 1053 EDNS0 in its DNS requests.
970 1054
971 "PERL_ANYEVENT_MAX_FORKS" 1055 "PERL_ANYEVENT_MAX_FORKS"
972 The maximum number of child processes that 1056 The maximum number of child processes that
973 "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.
974 1074
975SUPPLYING YOUR OWN EVENT MODEL INTERFACE 1075SUPPLYING YOUR OWN EVENT MODEL INTERFACE
976 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
977 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
978 to provide AnyEvent compatibility. 1078 to provide AnyEvent compatibility.
1483 SIGCHLD 1583 SIGCHLD
1484 A handler for "SIGCHLD" is installed by AnyEvent's child watcher 1584 A handler for "SIGCHLD" is installed by AnyEvent's child watcher
1485 emulation for event loops that do not support them natively. Also, 1585 emulation for event loops that do not support them natively. Also,
1486 some event loops install a similar handler. 1586 some event loops install a similar handler.
1487 1587
1488 If, when AnyEvent is loaded, SIGCHLD is set to IGNORE, then AnyEvent 1588 Additionally, when AnyEvent is loaded and SIGCHLD is set to IGNORE,
1489 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.
1490 1591
1491 SIGPIPE 1592 SIGPIPE
1492 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
1493 "undef" when AnyEvent gets loaded. 1594 "undef" when AnyEvent gets loaded.
1494 1595
1549 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,
1550 Event::Lib, Qt, POE. 1651 Event::Lib, Qt, POE.
1551 1652
1552 Implementations: AnyEvent::Impl::EV, AnyEvent::Impl::Event, 1653 Implementations: AnyEvent::Impl::EV, AnyEvent::Impl::Event,
1553 AnyEvent::Impl::Glib, AnyEvent::Impl::Tk, AnyEvent::Impl::Perl, 1654 AnyEvent::Impl::Glib, AnyEvent::Impl::Tk, AnyEvent::Impl::Perl,
1554 AnyEvent::Impl::EventLib, AnyEvent::Impl::Qt, AnyEvent::Impl::POE. 1655 AnyEvent::Impl::EventLib, AnyEvent::Impl::Qt, AnyEvent::Impl::POE,
1656 AnyEvent::Impl::IOAsync.
1555 1657
1556 Non-blocking file handles, sockets, TCP clients and servers: 1658 Non-blocking file handles, sockets, TCP clients and servers:
1557 AnyEvent::Handle, AnyEvent::Socket. 1659 AnyEvent::Handle, AnyEvent::Socket, AnyEvent::TLS.
1558 1660
1559 Asynchronous DNS: AnyEvent::DNS. 1661 Asynchronous DNS: AnyEvent::DNS.
1560 1662
1561 Coroutine support: Coro, Coro::AnyEvent, Coro::EV, Coro::Event, 1663 Coroutine support: Coro, Coro::AnyEvent, Coro::EV, Coro::Event,
1562 1664
1563 Nontrivial usage examples: Net::FCP, Net::XMPP2, AnyEvent::DNS. 1665 Nontrivial usage examples: AnyEvent::GPSD, AnyEvent::XMPP,
1666 AnyEvent::HTTP.
1564 1667
1565AUTHOR 1668AUTHOR
1566 Marc Lehmann <schmorp@schmorp.de> 1669 Marc Lehmann <schmorp@schmorp.de>
1567 http://home.schmorp.de/ 1670 http://home.schmorp.de/
1568 1671

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines