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

Comparing AnyEvent/README (file contents):
Revision 1.57 by root, Sat Dec 5 02:52:03 2009 UTC vs.
Revision 1.58 by root, Sun Dec 20 22:49:52 2009 UTC

919 You should check $AnyEvent::MODEL before adding to this array, 919 You should check $AnyEvent::MODEL before adding to this array,
920 though: if it is defined then the event loop has already been 920 though: if it is defined then the event loop has already been
921 detected, and the array will be ignored. 921 detected, and the array will be ignored.
922 922
923 Best use "AnyEvent::post_detect { BLOCK }" when your application 923 Best use "AnyEvent::post_detect { BLOCK }" when your application
924 allows it,as it takes care of these details. 924 allows it, as it takes care of these details.
925 925
926 This variable is mainly useful for modules that can do something 926 This variable is mainly useful for modules that can do something
927 useful when AnyEvent is used and thus want to know when it is 927 useful when AnyEvent is used and thus want to know when it is
928 initialised, but do not need to even load it by default. This array 928 initialised, but do not need to even load it by default. This array
929 provides the means to hook into AnyEvent passively, without loading 929 provides the means to hook into AnyEvent passively, without loading
930 it. 930 it.
931
932 Example: To load Coro::AnyEvent whenever Coro and AnyEvent are used
933 together, you could put this into Coro (this is the actual code used
934 by Coro to accomplish this):
935
936 if (defined $AnyEvent::MODEL) {
937 # AnyEvent already initialised, so load Coro::AnyEvent
938 require Coro::AnyEvent;
939 } else {
940 # AnyEvent not yet initialised, so make sure to load Coro::AnyEvent
941 # as soon as it is
942 push @AnyEvent::post_detect, sub { require Coro::AnyEvent };
943 }
931 944
932WHAT TO DO IN A MODULE 945WHAT TO DO IN A MODULE
933 As a module author, you should "use AnyEvent" and call AnyEvent methods 946 As a module author, you should "use AnyEvent" and call AnyEvent methods
934 freely, but you should not load a specific event module or rely on it. 947 freely, but you should not load a specific event module or rely on it.
935 948

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines