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.330 by root, Tue Aug 31 00:59:55 2010 UTC vs.
Revision 1.339 by root, Fri Dec 3 18:38:32 2010 UTC

46in a tutorial or some gentle introduction, have a look at the 46in a tutorial or some gentle introduction, have a look at the
47L<AnyEvent::Intro> manpage. 47L<AnyEvent::Intro> manpage.
48 48
49=head1 SUPPORT 49=head1 SUPPORT
50 50
51An FAQ document is available as L<AnyEvent::FAQ>.
52
51There is a mailinglist for discussing all things AnyEvent, and an IRC 53There also is a mailinglist for discussing all things AnyEvent, and an IRC
52channel, too. 54channel, too.
53 55
54See the AnyEvent project page at the B<Schmorpforge Ta-Sa Software 56See the AnyEvent project page at the B<Schmorpforge Ta-Sa Software
55Repository>, at L<http://anyevent.schmorp.de>, for more info. 57Repository>, at L<http://anyevent.schmorp.de>, for more info.
56 58
119The interface itself is vaguely similar, but not identical to the L<Event> 121The interface itself is vaguely similar, but not identical to the L<Event>
120module. 122module.
121 123
122During the first call of any watcher-creation method, the module tries 124During the first call of any watcher-creation method, the module tries
123to detect the currently loaded event loop by probing whether one of the 125to detect the currently loaded event loop by probing whether one of the
124following modules is already loaded: L<EV>, 126following modules is already loaded: L<EV>, L<AnyEvent::Impl::Perl>,
125L<Event>, L<Glib>, L<AnyEvent::Impl::Perl>, L<Tk>, L<Event::Lib>, L<Qt>, 127L<Event>, L<Glib>, L<Tk>, L<Event::Lib>, L<Qt>, L<POE>. The first one
126L<POE>. The first one found is used. If none are found, the module tries 128found is used. If none are detected, the module tries to load the first
127to load these modules (excluding Tk, Event::Lib, Qt and POE as the pure perl 129four modules in the order given; but note that if L<EV> is not
128adaptor should always succeed) in the order given. The first one that can 130available, the pure-perl L<AnyEvent::Impl::Perl> should always work, so
129be successfully loaded will be used. If, after this, still none could be 131the other two are not normally tried.
130found, AnyEvent will fall back to a pure-perl event loop, which is not
131very efficient, but should work everywhere.
132 132
133Because AnyEvent first checks for modules that are already loaded, loading 133Because AnyEvent first checks for modules that are already loaded, loading
134an event model explicitly before first using AnyEvent will likely make 134an event model explicitly before first using AnyEvent will likely make
135that model the default. For example: 135that model the default. For example:
136 136
1157 1157
1158package AnyEvent; 1158package AnyEvent;
1159 1159
1160# basically a tuned-down version of common::sense 1160# basically a tuned-down version of common::sense
1161sub common_sense { 1161sub 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
1168BEGIN { AnyEvent::common_sense } 1168BEGIN { AnyEvent::common_sense }
1169 1169
1170use Carp (); 1170use Carp ();
1171 1171
1172our $VERSION = '5.271'; 1172our $VERSION = '5.29';
1173our $MODEL; 1173our $MODEL;
1174 1174
1175our $AUTOLOAD; 1175our $AUTOLOAD;
1176our @ISA; 1176our @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 }
1311 1311
1312 require AnyEvent::Strict if $ENV{PERL_ANYEVENT_STRICT}; 1312 if ($ENV{PERL_ANYEVENT_STRICT}) {
1313 eval { require AnyEvent::Strict };
1314 warn "AnyEvent: cannot load AnyEvent::Strict ($@)\n"
1315 if $@ && $VERBOSE;
1316 }
1313 1317
1314 (shift @post_detect)->() while @post_detect; 1318 (shift @post_detect)->() while @post_detect;
1315 1319
1316 *post_detect = sub(&) { 1320 *post_detect = sub(&) {
1317 shift->(); 1321 shift->();
1726} 1730}
1727 1731
1728package AnyEvent::CondVar; 1732package AnyEvent::CondVar;
1729 1733
1730our @ISA = AnyEvent::CondVar::Base::; 1734our @ISA = AnyEvent::CondVar::Base::;
1735
1736# only to be used for subclassing
1737sub new {
1738 my $class = shift;
1739 bless AnyEvent->condvar (@_), $class
1740}
1731 1741
1732package AnyEvent::CondVar::Base; 1742package AnyEvent::CondVar::Base;
1733 1743
1734#use overload 1744#use overload
1735# '&{}' => sub { my $self = shift; sub { $self->send (@_) } }, 1745# '&{}' => sub { my $self = shift; sub { $self->send (@_) } },
2654pronounced). 2664pronounced).
2655 2665
2656 2666
2657=head1 SEE ALSO 2667=head1 SEE ALSO
2658 2668
2669Tutorial/Introduction: L<AnyEvent::Intro>.
2670
2671FAQ: L<AnyEvent::FAQ>.
2672
2659Utility functions: L<AnyEvent::Util>. 2673Utility functions: L<AnyEvent::Util>.
2660 2674
2661Event modules: L<EV>, L<EV::Glib>, L<Glib::EV>, L<Event>, L<Glib::Event>, 2675Event modules: L<EV>, L<EV::Glib>, L<Glib::EV>, L<Event>, L<Glib::Event>,
2662L<Glib>, L<Tk>, L<Event::Lib>, L<Qt>, L<POE>. 2676L<Glib>, L<Tk>, L<Event::Lib>, L<Qt>, L<POE>.
2663 2677
2669Non-blocking file handles, sockets, TCP clients and 2683Non-blocking file handles, sockets, TCP clients and
2670servers: L<AnyEvent::Handle>, L<AnyEvent::Socket>, L<AnyEvent::TLS>. 2684servers: L<AnyEvent::Handle>, L<AnyEvent::Socket>, L<AnyEvent::TLS>.
2671 2685
2672Asynchronous DNS: L<AnyEvent::DNS>. 2686Asynchronous DNS: L<AnyEvent::DNS>.
2673 2687
2674Coroutine support: L<Coro>, L<Coro::AnyEvent>, L<Coro::EV>, 2688Thread support: L<Coro>, L<Coro::AnyEvent>, L<Coro::EV>, L<Coro::Event>.
2675L<Coro::Event>,
2676 2689
2677Nontrivial usage examples: L<AnyEvent::GPSD>, L<AnyEvent::XMPP>, 2690Nontrivial usage examples: L<AnyEvent::GPSD>, L<AnyEvent::IRC>,
2678L<AnyEvent::HTTP>. 2691L<AnyEvent::HTTP>.
2679 2692
2680 2693
2681=head1 AUTHOR 2694=head1 AUTHOR
2682 2695

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines