… | |
… | |
962 | |
962 | |
963 | Arranges for the code block to be executed as soon as the event model is |
963 | Arranges for the code block to be executed as soon as the event model is |
964 | autodetected (or immediately if that has already happened). |
964 | autodetected (or immediately if that has already happened). |
965 | |
965 | |
966 | The block will be executed I<after> the actual backend has been detected |
966 | The block will be executed I<after> the actual backend has been detected |
967 | (C<$AnyEvent::MODEL> is set), but I<before> any watchers have been |
967 | (C<$AnyEvent::MODEL> is set), so it is possible to do some initialisation |
968 | created, so it is possible to e.g. patch C<@AnyEvent::ISA> or do |
968 | only when AnyEvent is actually initialised - see the sources of |
969 | other initialisations - see the sources of L<AnyEvent::Strict> or |
|
|
970 | L<AnyEvent::AIO> to see how this is used. |
969 | L<AnyEvent::AIO> to see how this is used. |
971 | |
970 | |
972 | The most common usage is to create some global watchers, without forcing |
971 | The most common usage is to create some global watchers, without forcing |
973 | event module detection too early, for example, L<AnyEvent::AIO> creates |
972 | event module detection too early. For example, L<AnyEvent::AIO> creates |
974 | and installs the global L<IO::AIO> watcher in a C<post_detect> block to |
973 | and installs the global L<IO::AIO> watcher in a C<post_detect> block to |
975 | avoid autodetecting the event module at load time. |
974 | avoid autodetecting the event module at load time. |
976 | |
975 | |
977 | If called in scalar or list context, then it creates and returns an object |
976 | If called in scalar or list context, then it creates and returns an object |
978 | that automatically removes the callback again when it is destroyed (or |
977 | that automatically removes the callback again when it is destroyed (or |