… | |
… | |
995 | |
995 | |
996 | $WATCHER ||= $guard; |
996 | $WATCHER ||= $guard; |
997 | |
997 | |
998 | =item @AnyEvent::post_detect |
998 | =item @AnyEvent::post_detect |
999 | |
999 | |
1000 | If there are any code references in this array (you can C<push> to it |
1000 | This is a lower level interface then C<AnyEvent::post_detect> (the |
|
|
1001 | function). This variable is mainly useful for modules that can do |
|
|
1002 | something useful when AnyEvent is used and thus want to know when it |
|
|
1003 | is initialised, but do not need to even load it by default. This array |
|
|
1004 | provides the means to hook into AnyEvent passively, without loading it. |
|
|
1005 | |
|
|
1006 | Here is how it works: If there are any code references in this array (you |
1001 | before or after loading AnyEvent), then they will be called directly |
1007 | can C<push> to it before or after loading AnyEvent), then they will be |
1002 | after the event loop has been chosen. |
1008 | called directly after the event loop has been chosen. |
1003 | |
1009 | |
1004 | You should check C<$AnyEvent::MODEL> before adding to this array, though: |
1010 | You should check C<$AnyEvent::MODEL> before adding to this array, though: |
1005 | if it is defined then the event loop has already been detected, and the |
1011 | if it is defined then the event loop has already been detected, and the |
1006 | array will be ignored. |
1012 | array will be ignored. |
1007 | |
1013 | |
1008 | Best use C<AnyEvent::post_detect { BLOCK }> when your application allows |
1014 | Best use C<AnyEvent::post_detect { BLOCK }> when your application allows |
1009 | it, as it takes care of these details. |
1015 | it, as it takes care of these details. |
1010 | |
|
|
1011 | This variable is mainly useful for modules that can do something useful |
|
|
1012 | when AnyEvent is used and thus want to know when it is initialised, but do |
|
|
1013 | not need to even load it by default. This array provides the means to hook |
|
|
1014 | into AnyEvent passively, without loading it. |
|
|
1015 | |
1016 | |
1016 | Example: To load Coro::AnyEvent whenever Coro and AnyEvent are used |
1017 | Example: To load Coro::AnyEvent whenever Coro and AnyEvent are used |
1017 | together, you could put this into Coro (this is the actual code used by |
1018 | together, you could put this into Coro (this is the actual code used by |
1018 | Coro to accomplish this): |
1019 | Coro to accomplish this): |
1019 | |
1020 | |