… | |
… | |
68 | |
68 | |
69 | no warnings; |
69 | no warnings; |
70 | use strict 'vars'; |
70 | use strict 'vars'; |
71 | use Carp; |
71 | use Carp; |
72 | |
72 | |
73 | our $VERSION = '1.0'; |
73 | our $VERSION = '1.02'; |
74 | our $MODEL; |
74 | our $MODEL; |
75 | |
75 | |
76 | our $AUTOLOAD; |
76 | our $AUTOLOAD; |
77 | our @ISA; |
77 | our @ISA; |
78 | |
78 | |
… | |
… | |
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 | |