… | |
… | |
46 | in a tutorial or some gentle introduction, have a look at the |
46 | in a tutorial or some gentle introduction, have a look at the |
47 | L<AnyEvent::Intro> manpage. |
47 | L<AnyEvent::Intro> manpage. |
48 | |
48 | |
49 | =head1 SUPPORT |
49 | =head1 SUPPORT |
50 | |
50 | |
|
|
51 | An FAQ document is available as L<AnyEvent::FAQ>. |
|
|
52 | |
51 | There is a mailinglist for discussing all things AnyEvent, and an IRC |
53 | There also is a mailinglist for discussing all things AnyEvent, and an IRC |
52 | channel, too. |
54 | channel, too. |
53 | |
55 | |
54 | See the AnyEvent project page at the B<Schmorpforge Ta-Sa Software |
56 | See the AnyEvent project page at the B<Schmorpforge Ta-Sa Software |
55 | Repository>, at L<http://anyevent.schmorp.de>, for more info. |
57 | Repository>, at L<http://anyevent.schmorp.de>, for more info. |
56 | |
58 | |
… | |
… | |
119 | The interface itself is vaguely similar, but not identical to the L<Event> |
121 | The interface itself is vaguely similar, but not identical to the L<Event> |
120 | module. |
122 | module. |
121 | |
123 | |
122 | During the first call of any watcher-creation method, the module tries |
124 | During the first call of any watcher-creation method, the module tries |
123 | to detect the currently loaded event loop by probing whether one of the |
125 | to detect the currently loaded event loop by probing whether one of the |
124 | following modules is already loaded: L<EV>, |
126 | following modules is already loaded: L<EV>, L<AnyEvent::Impl::Perl>, |
125 | L<Event>, L<Glib>, L<AnyEvent::Impl::Perl>, L<Tk>, L<Event::Lib>, L<Qt>, |
127 | L<Event>, L<Glib>, L<Tk>, L<Event::Lib>, L<Qt>, L<POE>. The first one |
126 | L<POE>. The first one found is used. If none are found, the module tries |
128 | found is used. If none are detected, the module tries to load the first |
127 | to load these modules (excluding Tk, Event::Lib, Qt and POE as the pure perl |
129 | four modules in the order given; but note that if L<EV> is not |
128 | adaptor should always succeed) in the order given. The first one that can |
130 | available, the pure-perl L<AnyEvent::Impl::Perl> should always work, so |
129 | be successfully loaded will be used. If, after this, still none could be |
131 | the other two are not normally tried. |
130 | found, AnyEvent will fall back to a pure-perl event loop, which is not |
|
|
131 | very efficient, but should work everywhere. |
|
|
132 | |
132 | |
133 | Because AnyEvent first checks for modules that are already loaded, loading |
133 | Because AnyEvent first checks for modules that are already loaded, loading |
134 | an event model explicitly before first using AnyEvent will likely make |
134 | an event model explicitly before first using AnyEvent will likely make |
135 | that model the default. For example: |
135 | that model the default. For example: |
136 | |
136 | |
… | |
… | |
1157 | |
1157 | |
1158 | package AnyEvent; |
1158 | package AnyEvent; |
1159 | |
1159 | |
1160 | # basically a tuned-down version of common::sense |
1160 | # basically a tuned-down version of common::sense |
1161 | sub common_sense { |
1161 | sub common_sense { |
1162 | # from common:.sense 1.0 |
1162 | # from common:.sense 3.3 |
1163 | ${^WARNING_BITS} = "\xfc\x3f\x33\x00\x0f\xf3\xcf\xc0\xf3\xfc\x33\x00"; |
1163 | ${^WARNING_BITS} ^= ${^WARNING_BITS} ^ "\x3c\x3f\x33\x00\x0f\xf3\x0f\xc0\xf0\xfc\x33\x00"; |
1164 | # use strict vars subs - NO UTF-8, as Util.pm doesn't like this atm. (uts46data.pl) |
1164 | # use strict vars subs - NO UTF-8, as Util.pm doesn't like this atm. (uts46data.pl) |
1165 | $^H |= 0x00000600; |
1165 | $^H |= 0x00000600; |
1166 | } |
1166 | } |
1167 | |
1167 | |
1168 | BEGIN { AnyEvent::common_sense } |
1168 | BEGIN { AnyEvent::common_sense } |
1169 | |
1169 | |
1170 | use Carp (); |
1170 | use Carp (); |
1171 | |
1171 | |
1172 | our $VERSION = '5.271'; |
1172 | our $VERSION = '5.29'; |
1173 | our $MODEL; |
1173 | our $MODEL; |
1174 | |
1174 | |
1175 | our $AUTOLOAD; |
1175 | our $AUTOLOAD; |
1176 | our @ISA; |
1176 | our @ISA; |
1177 | |
1177 | |
… | |
… | |
1291 | last; |
1291 | last; |
1292 | } |
1292 | } |
1293 | } |
1293 | } |
1294 | |
1294 | |
1295 | $MODEL |
1295 | $MODEL |
1296 | or die "No event module selected for AnyEvent and autodetect failed. Install any one of these modules: EV, Event or Glib.\n"; |
1296 | or die "AnyEvent: backend autodetection failed - did you properly install AnyEvent?\n"; |
1297 | } |
1297 | } |
1298 | } |
1298 | } |
1299 | |
1299 | |
1300 | @models = (); # free probe data |
1300 | @models = (); # free probe data |
1301 | |
1301 | |
1302 | push @{"$MODEL\::ISA"}, "AnyEvent::Base"; |
1302 | push @{"$MODEL\::ISA"}, "AnyEvent::Base"; |
1303 | unshift @ISA, $MODEL; |
1303 | unshift @ISA, $MODEL; |
1304 | |
1304 | |
1305 | # now nuke some methods that are overriden by the backend. |
1305 | # now nuke some methods that are overridden by the backend. |
1306 | # SUPER is not allowed. |
1306 | # SUPER is not allowed. |
1307 | for (qw(time signal child idle)) { |
1307 | for (qw(time signal child idle)) { |
1308 | undef &{"AnyEvent::Base::$_"} |
1308 | undef &{"AnyEvent::Base::$_"} |
1309 | if defined &{"$MODEL\::$_"}; |
1309 | if defined &{"$MODEL\::$_"}; |
1310 | } |
1310 | } |
… | |
… | |
1726 | } |
1726 | } |
1727 | |
1727 | |
1728 | package AnyEvent::CondVar; |
1728 | package AnyEvent::CondVar; |
1729 | |
1729 | |
1730 | our @ISA = AnyEvent::CondVar::Base::; |
1730 | our @ISA = AnyEvent::CondVar::Base::; |
|
|
1731 | |
|
|
1732 | # only to be used for subclassing |
|
|
1733 | sub new { |
|
|
1734 | my $class = shift; |
|
|
1735 | bless AnyEvent->condvar (@_), $class |
|
|
1736 | } |
1731 | |
1737 | |
1732 | package AnyEvent::CondVar::Base; |
1738 | package AnyEvent::CondVar::Base; |
1733 | |
1739 | |
1734 | #use overload |
1740 | #use overload |
1735 | # '&{}' => sub { my $self = shift; sub { $self->send (@_) } }, |
1741 | # '&{}' => sub { my $self = shift; sub { $self->send (@_) } }, |
… | |
… | |
2654 | pronounced). |
2660 | pronounced). |
2655 | |
2661 | |
2656 | |
2662 | |
2657 | =head1 SEE ALSO |
2663 | =head1 SEE ALSO |
2658 | |
2664 | |
|
|
2665 | Tutorial/Introduction: L<AnyEvent::Intro>. |
|
|
2666 | |
|
|
2667 | FAQ: L<AnyEvent::FAQ>. |
|
|
2668 | |
2659 | Utility functions: L<AnyEvent::Util>. |
2669 | Utility functions: L<AnyEvent::Util>. |
2660 | |
2670 | |
2661 | Event modules: L<EV>, L<EV::Glib>, L<Glib::EV>, L<Event>, L<Glib::Event>, |
2671 | Event modules: L<EV>, L<EV::Glib>, L<Glib::EV>, L<Event>, L<Glib::Event>, |
2662 | L<Glib>, L<Tk>, L<Event::Lib>, L<Qt>, L<POE>. |
2672 | L<Glib>, L<Tk>, L<Event::Lib>, L<Qt>, L<POE>. |
2663 | |
2673 | |
… | |
… | |
2669 | Non-blocking file handles, sockets, TCP clients and |
2679 | Non-blocking file handles, sockets, TCP clients and |
2670 | servers: L<AnyEvent::Handle>, L<AnyEvent::Socket>, L<AnyEvent::TLS>. |
2680 | servers: L<AnyEvent::Handle>, L<AnyEvent::Socket>, L<AnyEvent::TLS>. |
2671 | |
2681 | |
2672 | Asynchronous DNS: L<AnyEvent::DNS>. |
2682 | Asynchronous DNS: L<AnyEvent::DNS>. |
2673 | |
2683 | |
2674 | Coroutine support: L<Coro>, L<Coro::AnyEvent>, L<Coro::EV>, |
2684 | Thread support: L<Coro>, L<Coro::AnyEvent>, L<Coro::EV>, L<Coro::Event>. |
2675 | L<Coro::Event>, |
|
|
2676 | |
2685 | |
2677 | Nontrivial usage examples: L<AnyEvent::GPSD>, L<AnyEvent::XMPP>, |
2686 | Nontrivial usage examples: L<AnyEvent::GPSD>, L<AnyEvent::IRC>, |
2678 | L<AnyEvent::HTTP>. |
2687 | L<AnyEvent::HTTP>. |
2679 | |
2688 | |
2680 | |
2689 | |
2681 | =head1 AUTHOR |
2690 | =head1 AUTHOR |
2682 | |
2691 | |