… | |
… | |
44 | C<< ->wait >> for it. See the examples below. |
44 | C<< ->wait >> for it. See the examples below. |
45 | |
45 | |
46 | =head1 DESCRIPTION |
46 | =head1 DESCRIPTION |
47 | |
47 | |
48 | L<AnyEvent> provides an identical interface to multiple event loops. This |
48 | L<AnyEvent> provides an identical interface to multiple event loops. This |
49 | allows module authors to utilizy an event loop without forcing module |
49 | allows module authors to utilise an event loop without forcing module |
50 | users to use the same event loop (as only a single event loop can coexist |
50 | users to use the same event loop (as only a single event loop can coexist |
51 | peacefully at any one time). |
51 | peacefully at any one time). |
52 | |
52 | |
53 | The interface itself is vaguely similar but not identical to the Event |
53 | The interface itself is vaguely similar but not identical to the Event |
54 | module. |
54 | module. |
… | |
… | |
135 | |
135 | |
136 | =head1 SUPPLYING YOUR OWN EVENT MODEL INTERFACE |
136 | =head1 SUPPLYING YOUR OWN EVENT MODEL INTERFACE |
137 | |
137 | |
138 | If you need to support another event library which isn't directly |
138 | If you need to support another event library which isn't directly |
139 | supported by AnyEvent, you can supply your own interface to it by |
139 | supported by AnyEvent, you can supply your own interface to it by |
140 | pushing, before the first watch gets created, the package name of |
140 | pushing, before the first watcher gets created, the package name of |
141 | the event module and the package name of the interface to use onto |
141 | the event module and the package name of the interface to use onto |
142 | C<@AnyEvent::REGISTRY>. You can do that before and even without loading |
142 | C<@AnyEvent::REGISTRY>. You can do that before and even without loading |
143 | AnyEvent. |
143 | AnyEvent. |
144 | |
144 | |
145 | Example: |
145 | Example: |
146 | |
146 | |
147 | push @AnyEvent::REGISTRY, [urxvt => urxvt::anyevent::]; |
147 | push @AnyEvent::REGISTRY, [urxvt => urxvt::anyevent::]; |
148 | |
148 | |
149 | This tells AnyEvent to (literally) use the C<urxvt::anyevent::> module |
149 | This tells AnyEvent to (literally) use the C<urxvt::anyevent::> |
150 | when it finds the C<urxvt> module is loaded. When AnyEvent is loaded and |
150 | package/class when it finds the C<urxvt> package/module is loaded. When |
151 | requested to find a suitable event model, it will first check for the |
151 | AnyEvent is loaded and asked to find a suitable event model, it will |
152 | urxvt module. |
152 | first check for the presence of urxvt. |
153 | |
153 | |
|
|
154 | The class should prove implementations for all watcher types (see |
|
|
155 | L<AnyEvent::Impl::Event> (source code), L<AnyEvent::Impl::Glib> |
|
|
156 | (Source code) and so on for actual examples, use C<perldoc -m |
|
|
157 | AnyEvent::Impl::Glib> to see the sources). |
|
|
158 | |
154 | The above isn't fictitious, the I<rxvt-unicode> (a.k.a. urxvt) uses |
159 | The above isn't fictitious, the I<rxvt-unicode> (a.k.a. urxvt) |
155 | the above line exactly. An interface isn't included in AnyEvent |
160 | uses the above line as-is. An interface isn't included in AnyEvent |
156 | because it doesn't make sense outside the embedded interpreter inside |
161 | because it doesn't make sense outside the embedded interpreter inside |
157 | I<rxvt-unicode>, and it is updated and maintained as part of the |
162 | I<rxvt-unicode>, and it is updated and maintained as part of the |
158 | I<rxvt-unicode> distribution. |
163 | I<rxvt-unicode> distribution. |
|
|
164 | |
|
|
165 | I<rxvt-unicode> also cheats a bit by not providing blocking access to |
|
|
166 | condition variables: code blocking while waiting for a condition will |
|
|
167 | C<die>. This still works with most modules/usages, and blocking calls must |
|
|
168 | not be in an interactive appliation, so it makes sense. |
159 | |
169 | |
160 | =head1 ENVIRONMENT VARIABLES |
170 | =head1 ENVIRONMENT VARIABLES |
161 | |
171 | |
162 | The following environment variables are used by this module: |
172 | The following environment variables are used by this module: |
163 | |
173 | |