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

Comparing AnyEvent/lib/AnyEvent.pm (file contents):
Revision 1.10 by root, Fri Jan 13 13:16:15 2006 UTC vs.
Revision 1.12 by root, Thu Jul 20 01:39:40 2006 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines