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.352 by root, Thu Aug 4 09:14:01 2011 UTC vs.
Revision 1.361 by root, Sun Aug 14 01:38:14 2011 UTC

878 AnyEvent::Impl::EventLib based on Event::Lib, leaks memory and worse. 878 AnyEvent::Impl::EventLib based on Event::Lib, leaks memory and worse.
879 AnyEvent::Impl::POE based on POE, very slow, some limitations. 879 AnyEvent::Impl::POE based on POE, very slow, some limitations.
880 AnyEvent::Impl::Irssi used when running within irssi. 880 AnyEvent::Impl::Irssi used when running within irssi.
881 AnyEvent::Impl::IOAsync based on IO::Async. 881 AnyEvent::Impl::IOAsync based on IO::Async.
882 AnyEvent::Impl::Cocoa based on Cocoa::EventLoop. 882 AnyEvent::Impl::Cocoa based on Cocoa::EventLoop.
883 AnyEvent::Impl::FLTK based on FLTK. 883 AnyEvent::Impl::FLTK2 based on FLTK (fltk 2 binding).
884 884
885=item Backends with special needs. 885=item Backends with special needs.
886 886
887Qt requires the Qt::Application to be instantiated first, but will 887Qt requires the Qt::Application to be instantiated first, but will
888otherwise be picked up automatically. As long as the main program 888otherwise be picked up automatically. As long as the main program
933 933
934Returns C<$AnyEvent::MODEL>, forcing autodetection of the event model 934Returns C<$AnyEvent::MODEL>, forcing autodetection of the event model
935if necessary. You should only call this function right before you would 935if necessary. You should only call this function right before you would
936have created an AnyEvent watcher anyway, that is, as late as possible at 936have created an AnyEvent watcher anyway, that is, as late as possible at
937runtime, and not e.g. during initialisation of your module. 937runtime, and not e.g. during initialisation of your module.
938
939The effect of calling this function is as if a watcher had been created
940(specifically, actions that happen "when the first watcher is created"
941happen when calling detetc as well).
938 942
939If you need to do some initialisation before AnyEvent watchers are 943If you need to do some initialisation before AnyEvent watchers are
940created, use C<post_detect>. 944created, use C<post_detect>.
941 945
942=item $guard = AnyEvent::post_detect { BLOCK } 946=item $guard = AnyEvent::post_detect { BLOCK }
1005 # AnyEvent not yet initialised, so make sure to load Coro::AnyEvent 1009 # AnyEvent not yet initialised, so make sure to load Coro::AnyEvent
1006 # as soon as it is 1010 # as soon as it is
1007 push @AnyEvent::post_detect, sub { require Coro::AnyEvent }; 1011 push @AnyEvent::post_detect, sub { require Coro::AnyEvent };
1008 } 1012 }
1009 1013
1014=item AnyEvent::postpone { BLOCK }
1015
1016Arranges for the block to be executed as soon as possible, but not before
1017the call itself returns. In practise, the block will be executed just
1018before the event loop polls for new events, or shortly afterwards.
1019
1020This function never returns anything (to make the C<return postpone { ...
1021}> idiom more useful.
1022
1023To understand the usefulness of this function, consider a function that
1024asynchronously does something for you and returns some transaction
1025object or guard to let you cancel the operation. For example,
1026C<AnyEvent::Socket::tcp_connect>:
1027
1028 # start a conenction attempt unless one is active
1029 $self->{connect_guard} ||= AnyEvent::Socket::tcp_connect "www.example.net", 80, sub {
1030 delete $self->{connect_guard};
1031 ...
1032 };
1033
1034Imagine that this function could instantly call the callback, for
1035example, because it detects an obvious error such as a negative port
1036number. Invoking the callback before the function returns causes problems
1037however: the callback will be called and will try to delete the guard
1038object. But since the function hasn't returned yet, there is nothing to
1039delete. When the function eventually returns it will assign the guard
1040object to C<< $self->{connect_guard} >>, where it will likely never be
1041deleted, so the program thinks it is still trying to connect.
1042
1043This is where C<AnyEvent::postpone> should be used. Instead of calling the
1044callback directly on error:
1045
1046 $cb->(undef), return # signal error to callback, BAD!
1047 if $some_error_condition;
1048
1049It should use C<postpone>:
1050
1051 AnyEvent::postpone { $cb->(undef) }, return # signal error to callback, later
1052 if $some_error_condition;
1053
1010=back 1054=back
1011 1055
1012=head1 WHAT TO DO IN A MODULE 1056=head1 WHAT TO DO IN A MODULE
1013 1057
1014As a module author, you should C<use AnyEvent> and call AnyEvent methods 1058As a module author, you should C<use AnyEvent> and call AnyEvent methods
1162 1206
1163BEGIN { AnyEvent::common_sense } 1207BEGIN { AnyEvent::common_sense }
1164 1208
1165use Carp (); 1209use Carp ();
1166 1210
1167our $VERSION = '5.34'; 1211our $VERSION = '6.01';
1168our $MODEL; 1212our $MODEL;
1169 1213
1170our $AUTOLOAD;
1171our @ISA; 1214our @ISA;
1172 1215
1173our @REGISTRY; 1216our @REGISTRY;
1174 1217
1175our $VERBOSE; 1218our $VERBOSE;
1195 $PROTOCOL{$_} = ++$idx 1238 $PROTOCOL{$_} = ++$idx
1196 for reverse split /\s*,\s*/, 1239 for reverse split /\s*,\s*/,
1197 $ENV{PERL_ANYEVENT_PROTOCOLS} || "ipv4,ipv6"; 1240 $ENV{PERL_ANYEVENT_PROTOCOLS} || "ipv4,ipv6";
1198} 1241}
1199 1242
1243our @post_detect;
1244
1245sub post_detect(&) {
1246 my ($cb) = @_;
1247
1248 push @post_detect, $cb;
1249
1250 defined wantarray
1251 ? bless \$cb, "AnyEvent::Util::postdetect"
1252 : ()
1253}
1254
1255sub AnyEvent::Util::postdetect::DESTROY {
1256 @post_detect = grep $_ != ${$_[0]}, @post_detect;
1257}
1258
1259our $POSTPONE_W;
1260our @POSTPONE;
1261
1262sub _postpone_exec {
1263 undef $POSTPONE_W;
1264
1265 &{ shift @POSTPONE }
1266 while @POSTPONE;
1267}
1268
1269sub postpone(&) {
1270 push @POSTPONE, shift;
1271
1272 $POSTPONE_W ||= AE::timer (0, 0, \&_postpone_exec);
1273
1274 ()
1275}
1276
1200my @models = ( 1277our @models = (
1201 [EV:: => AnyEvent::Impl::EV:: , 1], 1278 [EV:: => AnyEvent::Impl::EV:: , 1],
1202 [AnyEvent::Loop:: => AnyEvent::Impl::Perl:: , 1], 1279 [AnyEvent::Loop:: => AnyEvent::Impl::Perl:: , 1],
1203 # everything below here will not (normally) be autoprobed 1280 # everything below here will not (normally) be autoprobed
1204 # as the pure perl backend should work everywhere 1281 # as the pure perl backend should work everywhere
1205 # and is usually faster 1282 # and is usually faster
1210 [Tk:: => AnyEvent::Impl::Tk::], # crashes with many handles 1287 [Tk:: => AnyEvent::Impl::Tk::], # crashes with many handles
1211 [Qt:: => AnyEvent::Impl::Qt::], # requires special main program 1288 [Qt:: => AnyEvent::Impl::Qt::], # requires special main program
1212 [POE::Kernel:: => AnyEvent::Impl::POE::], # lasciate ogni speranza 1289 [POE::Kernel:: => AnyEvent::Impl::POE::], # lasciate ogni speranza
1213 [Wx:: => AnyEvent::Impl::POE::], 1290 [Wx:: => AnyEvent::Impl::POE::],
1214 [Prima:: => AnyEvent::Impl::POE::], 1291 [Prima:: => AnyEvent::Impl::POE::],
1215 [IO::Async::Loop:: => AnyEvent::Impl::IOAsync::], 1292 [IO::Async::Loop:: => AnyEvent::Impl::IOAsync::], # a bitch to autodetect
1216 [Cocoa::EventLoop:: => AnyEvent::Impl::Cocoa::], 1293 [Cocoa::EventLoop:: => AnyEvent::Impl::Cocoa::],
1217 [FLTK:: => AnyEvent::Impl::FLTK::], 1294 [FLTK:: => AnyEvent::Impl::FLTK2::],
1218); 1295);
1219 1296
1220our %method = map +($_ => 1), 1297our @isa_hook;
1298
1299sub _isa_set {
1300 my @pkg = ("AnyEvent", (grep defined, map $_->[0], @isa_hook), $MODEL);
1301
1302 @{"$pkg[$_-1]::ISA"} = $pkg[$_]
1303 for 1 .. $#pkg;
1304
1305 grep $_->[1], @isa_hook
1306 and AE::_reset ();
1307}
1308
1309# used for hooking AnyEvent::Strict and AnyEvent::Debug::Wrap into the class hierarchy
1310sub _isa_hook($$;$) {
1311 my ($i, $pkg, $reset_ae) = @_;
1312
1313 $isa_hook[$i] = [$pkg, $reset_ae];
1314
1315 _isa_set;
1316}
1317
1318# all autoloaded methods reserve the complete glob, not just the method slot.
1319# due to bugs in perls method cache implementation.
1221 qw(io timer time now now_update signal child idle condvar DESTROY); 1320our @methods = qw(io timer time now now_update signal child idle condvar);
1222
1223our @post_detect;
1224
1225sub post_detect(&) {
1226 my ($cb) = @_;
1227
1228 push @post_detect, $cb;
1229
1230 defined wantarray
1231 ? bless \$cb, "AnyEvent::Util::postdetect"
1232 : ()
1233}
1234
1235sub AnyEvent::Util::postdetect::DESTROY {
1236 @post_detect = grep $_ != ${$_[0]}, @post_detect;
1237}
1238 1321
1239sub detect() { 1322sub detect() {
1323 local $!; # for good measure
1324 local $SIG{__DIE__}; # we use eval
1325
1240 # free some memory 1326 # free some memory
1241 *detect = sub () { $MODEL }; 1327 *detect = sub () { $MODEL };
1328 # undef &func doesn't correctly update the method cache. grmbl.
1329 # so we delete the whole glob. grmbl.
1330 # otoh, perl doesn't let me undef an active usb, but it lets me free
1331 # a glob with an active sub. hrm. i hope it works, but perl is
1332 # usually buggy in this department. sigh.
1333 delete @{"AnyEvent::"}{@methods};
1334 undef @methods;
1242 1335
1243 local $!; # for good measure
1244 local $SIG{__DIE__};
1245
1246 if ($ENV{PERL_ANYEVENT_MODEL} =~ /^([a-zA-Z]+)$/) { 1336 if ($ENV{PERL_ANYEVENT_MODEL} =~ /^([a-zA-Z0-9:]+)$/) {
1247 my $model = "AnyEvent::Impl::$1"; 1337 my $model = $1;
1338 $model = "AnyEvent::Impl::$model" unless $model =~ s/::$//;
1248 if (eval "require $model") { 1339 if (eval "require $model") {
1249 $MODEL = $model; 1340 $MODEL = $model;
1250 warn "AnyEvent: loaded model '$model' (forced by \$ENV{PERL_ANYEVENT_MODEL}), using it.\n" if $VERBOSE >= 2; 1341 warn "AnyEvent: loaded model '$model' (forced by \$ENV{PERL_ANYEVENT_MODEL}), using it.\n" if $VERBOSE >= 2;
1251 } else { 1342 } else {
1252 warn "AnyEvent: unable to load model '$model' (from \$ENV{PERL_ANYEVENT_MODEL}):\n$@" if $VERBOSE; 1343 warn "AnyEvent: unable to load model '$model' (from \$ENV{PERL_ANYEVENT_MODEL}):\n$@" if $VERBOSE;
1285 $MODEL 1376 $MODEL
1286 or die "AnyEvent: backend autodetection failed - did you properly install AnyEvent?\n"; 1377 or die "AnyEvent: backend autodetection failed - did you properly install AnyEvent?\n";
1287 } 1378 }
1288 } 1379 }
1289 1380
1290 @models = (); # free probe data 1381 # free memory only needed for probing
1382 undef @models;
1383 undef @REGISTRY;
1291 1384
1292 push @{"$MODEL\::ISA"}, "AnyEvent::Base"; 1385 push @{"$MODEL\::ISA"}, "AnyEvent::Base";
1293 unshift @ISA, $MODEL;
1294 1386
1295 # now nuke some methods that are overridden by the backend. 1387 # now nuke some methods that are overridden by the backend.
1296 # SUPER is not allowed. 1388 # SUPER usage is not allowed in these.
1297 for (qw(time signal child idle)) { 1389 for (qw(time signal child idle)) {
1298 undef &{"AnyEvent::Base::$_"} 1390 undef &{"AnyEvent::Base::$_"}
1299 if defined &{"$MODEL\::$_"}; 1391 if defined &{"$MODEL\::$_"};
1300 } 1392 }
1301 1393
1394 _isa_set;
1395
1302 if ($ENV{PERL_ANYEVENT_STRICT}) { 1396 if ($ENV{PERL_ANYEVENT_STRICT}) {
1303 eval { require AnyEvent::Strict }; 1397 require AnyEvent::Strict;
1304 warn "AnyEvent: cannot load AnyEvent::Strict: $@"
1305 if $@ && $VERBOSE;
1306 } 1398 }
1307 1399
1400 if ($ENV{PERL_ANYEVENT_DEBUG_WRAP}) {
1401 require AnyEvent::Debug;
1402 AnyEvent::Debug::wrap ($ENV{PERL_ANYEVENT_DEBUG_WRAP});
1403 }
1404
1405 if (exists $ENV{PERL_ANYEVENT_DEBUG_SHELL}) {
1406 require AnyEvent::Socket;
1407 require AnyEvent::Debug;
1408
1409 my $shell = $ENV{PERL_ANYEVENT_DEBUG_SHELL};
1410 $shell =~ s/\$\$/$$/g;
1411
1412 my ($host, $service) = AnyEvent::Socket::parse_hostport ($shell);
1413 $AnyEvent::Debug::SHELL = AnyEvent::Debug::shell ($host, $service);
1414 }
1415
1308 (shift @post_detect)->() while @post_detect; 1416 (shift @post_detect)->() while @post_detect;
1417 undef @post_detect;
1309 1418
1310 *post_detect = sub(&) { 1419 *post_detect = sub(&) {
1311 shift->(); 1420 shift->();
1312 1421
1313 undef 1422 undef
1314 }; 1423 };
1315 1424
1316 $MODEL 1425 $MODEL
1317} 1426}
1318 1427
1319sub AUTOLOAD { 1428for my $name (@methods) {
1320 (my $func = $AUTOLOAD) =~ s/.*://; 1429 *$name = sub {
1321
1322 $method{$func}
1323 or Carp::croak "$func: not a valid AnyEvent class method";
1324
1325 detect; 1430 detect;
1326 1431 # we use goto because
1327 my $class = shift; 1432 # a) it makes the thunk more transparent
1328 $class->$func (@_); 1433 # b) it allows us to delete the thunk later
1434 goto &{ UNIVERSAL::can AnyEvent => "SUPER::$name" }
1435 };
1329} 1436}
1330 1437
1331# utility function to dup a filehandle. this is used by many backends 1438# utility function to dup a filehandle. this is used by many backends
1332# to support binding more than one watcher per filehandle (they usually 1439# to support binding more than one watcher per filehandle (they usually
1333# allow only one watcher per fd, so we dup it to get a different one). 1440# allow only one watcher per fd, so we dup it to get a different one).
1357 1464
1358package AE; 1465package AE;
1359 1466
1360our $VERSION = $AnyEvent::VERSION; 1467our $VERSION = $AnyEvent::VERSION;
1361 1468
1469sub _reset() {
1470 eval q{
1362# fall back to the main API by default - backends and AnyEvent::Base 1471 # fall back to the main API by default - backends and AnyEvent::Base
1363# implementations can overwrite these. 1472 # implementations can overwrite these.
1364 1473
1365sub io($$$) { 1474 sub io($$$) {
1366 AnyEvent->io (fh => $_[0], poll => $_[1] ? "w" : "r", cb => $_[2]) 1475 AnyEvent->io (fh => $_[0], poll => $_[1] ? "w" : "r", cb => $_[2])
1367} 1476 }
1368 1477
1369sub timer($$$) { 1478 sub timer($$$) {
1370 AnyEvent->timer (after => $_[0], interval => $_[1], cb => $_[2]) 1479 AnyEvent->timer (after => $_[0], interval => $_[1], cb => $_[2])
1371} 1480 }
1372 1481
1373sub signal($$) { 1482 sub signal($$) {
1374 AnyEvent->signal (signal => $_[0], cb => $_[1]) 1483 AnyEvent->signal (signal => $_[0], cb => $_[1])
1375} 1484 }
1376 1485
1377sub child($$) { 1486 sub child($$) {
1378 AnyEvent->child (pid => $_[0], cb => $_[1]) 1487 AnyEvent->child (pid => $_[0], cb => $_[1])
1379} 1488 }
1380 1489
1381sub idle($) { 1490 sub idle($) {
1382 AnyEvent->idle (cb => $_[0]) 1491 AnyEvent->idle (cb => $_[0]);
1383} 1492 }
1384 1493
1385sub cv(;&) { 1494 sub cv(;&) {
1386 AnyEvent->condvar (@_ ? (cb => $_[0]) : ()) 1495 AnyEvent->condvar (@_ ? (cb => $_[0]) : ())
1387} 1496 }
1388 1497
1389sub now() { 1498 sub now() {
1390 AnyEvent->now 1499 AnyEvent->now
1391} 1500 }
1392 1501
1393sub now_update() { 1502 sub now_update() {
1394 AnyEvent->now_update 1503 AnyEvent->now_update
1395} 1504 }
1396 1505
1397sub time() { 1506 sub time() {
1398 AnyEvent->time 1507 AnyEvent->time
1508 }
1509
1510 *postpone = \&AnyEvent::postpone;
1511 };
1512 die if $@;
1399} 1513}
1514
1515BEGIN { _reset }
1400 1516
1401package AnyEvent::Base; 1517package AnyEvent::Base;
1402 1518
1403# default implementations for many methods 1519# default implementations for many methods
1404 1520
1405sub time { 1521sub time {
1406 eval q{ # poor man's autoloading {} 1522 eval q{ # poor man's autoloading {}
1407 # probe for availability of Time::HiRes 1523 # probe for availability of Time::HiRes
1408 if (eval "use Time::HiRes (); Time::HiRes::time (); 1") { 1524 if (eval "use Time::HiRes (); Time::HiRes::time (); 1") {
1409 warn "AnyEvent: using Time::HiRes for sub-second timing accuracy.\n" if $VERBOSE >= 8; 1525 warn "AnyEvent: using Time::HiRes for sub-second timing accuracy.\n" if $VERBOSE >= 8;
1526 *time = sub { Time::HiRes::time () };
1410 *AE::time = \&Time::HiRes::time; 1527 *AE::time = \& Time::HiRes::time ;
1411 # if (eval "use POSIX (); (POSIX::times())... 1528 # if (eval "use POSIX (); (POSIX::times())...
1412 } else { 1529 } else {
1413 warn "AnyEvent: using built-in time(), WARNING, no sub-second resolution!\n" if $VERBOSE; 1530 warn "AnyEvent: using built-in time(), WARNING, no sub-second resolution!\n" if $VERBOSE;
1531 *time = sub { CORE::time };
1414 *AE::time = sub (){ time }; # epic fail 1532 *AE::time = sub (){ CORE::time };
1415 } 1533 }
1416 1534
1417 *time = sub { AE::time }; # different prototypes 1535 *now = \&time;
1418 }; 1536 };
1419 die if $@; 1537 die if $@;
1420 1538
1421 &time 1539 &time
1422} 1540}
1423 1541
1424*now = \&time; 1542*now = \&time;
1425
1426sub now_update { } 1543sub now_update { }
1427 1544
1428sub _poll { 1545sub _poll {
1429 Carp::croak "$AnyEvent::MODEL does not support blocking waits. Caught"; 1546 Carp::croak "$AnyEvent::MODEL does not support blocking waits. Caught";
1430} 1547}
1431 1548
1432# default implementation for ->condvar 1549# default implementation for ->condvar
1433# in fact,t he default should not be overwritten 1550# in fact, the default should not be overwritten
1434 1551
1435sub condvar { 1552sub condvar {
1436 eval q{ # poor man's autoloading {} 1553 eval q{ # poor man's autoloading {}
1437 *condvar = sub { 1554 *condvar = sub {
1438 bless { @_ == 3 ? (_ae_cb => $_[2]) : () }, "AnyEvent::CondVar" 1555 bless { @_ == 3 ? (_ae_cb => $_[2]) : () }, "AnyEvent::CondVar"
1608 : sysread $SIGPIPE_R, (my $dummy), 9; 1725 : sysread $SIGPIPE_R, (my $dummy), 9;
1609 1726
1610 while (%SIG_EV) { 1727 while (%SIG_EV) {
1611 for (keys %SIG_EV) { 1728 for (keys %SIG_EV) {
1612 delete $SIG_EV{$_}; 1729 delete $SIG_EV{$_};
1613 $_->() for values %{ $SIG_CB{$_} || {} }; 1730 &$_ for values %{ $SIG_CB{$_} || {} };
1614 } 1731 }
1615 } 1732 }
1616 }; 1733 };
1617 }; 1734 };
1618 die if $@; 1735 die if $@;
1685 1802
1686 my ($cb, $w, $rcb) = $arg{cb}; 1803 my ($cb, $w, $rcb) = $arg{cb};
1687 1804
1688 $rcb = sub { 1805 $rcb = sub {
1689 if ($cb) { 1806 if ($cb) {
1690 $w = _time; 1807 $w = AE::time;
1691 &$cb; 1808 &$cb;
1692 $w = _time - $w; 1809 $w = AE::time - $w;
1693 1810
1694 # never use more then 50% of the time for the idle watcher, 1811 # never use more then 50% of the time for the idle watcher,
1695 # within some limits 1812 # within some limits
1696 $w = 0.0001 if $w < 0.0001; 1813 $w = 0.0001 if $w < 0.0001;
1697 $w = 5 if $w > 5; 1814 $w = 5 if $w > 5;
1866Unlike C<use strict> (or its modern cousin, C<< use L<common::sense> 1983Unlike C<use strict> (or its modern cousin, C<< use L<common::sense>
1867>>, it is definitely recommended to keep it off in production. Keeping 1984>>, it is definitely recommended to keep it off in production. Keeping
1868C<PERL_ANYEVENT_STRICT=1> in your environment while developing programs 1985C<PERL_ANYEVENT_STRICT=1> in your environment while developing programs
1869can be very useful, however. 1986can be very useful, however.
1870 1987
1988=item C<PERL_ANYEVENT_DEBUG_SHELL>
1989
1990If this env variable is set, then its contents will be interpreted by
1991C<AnyEvent::Socket::parse_hostport> (after replacing every occurance of
1992C<$$> by the process pid) and an C<AnyEvent::Debug::shell> is bound on
1993that port. The shell object is saved in C<$AnyEvent::Debug::SHELL>.
1994
1995This takes place when the first watcher is created.
1996
1997For example, to bind a debug shell on a unix domain socket in
1998F<< /tmp/debug<pid>.sock >>, you could use this:
1999
2000 PERL_ANYEVENT_DEBUG_SHELL=unix/:/tmp/debug\$\$.sock perlprog
2001
2002Note that creating sockets in F</tmp> is very unsafe on multiuser
2003systems.
2004
2005=item C<PERL_ANYEVENT_DEBUG_WRAP>
2006
2007Can be set to C<0>, C<1> or C<2> and enables wrapping of all watchers for
2008debugging purposes. See C<AnyEvent::Debug::wrap> for details.
2009
1871=item C<PERL_ANYEVENT_MODEL> 2010=item C<PERL_ANYEVENT_MODEL>
1872 2011
1873This can be used to specify the event model to be used by AnyEvent, before 2012This can be used to specify the event model to be used by AnyEvent, before
1874auto detection and -probing kicks in. It must be a string consisting 2013auto detection and -probing kicks in.
1875entirely of ASCII letters. The string C<AnyEvent::Impl::> gets prepended 2014
2015It normally is a string consisting entirely of ASCII letters (e.g. C<EV>
2016or C<IOAsync>). The string C<AnyEvent::Impl::> gets prepended and the
1876and the resulting module name is loaded and if the load was successful, 2017resulting module name is loaded and - if the load was successful - used as
1877used as event model. If it fails to load AnyEvent will proceed with 2018event model backend. If it fails to load then AnyEvent will proceed with
1878auto detection and -probing. 2019auto detection and -probing.
1879 2020
1880This functionality might change in future versions. 2021If the string ends with C<::> instead (e.g. C<AnyEvent::Impl::EV::>) then
2022nothing gets prepended and the module name is used as-is (hint: C<::> at
2023the end of a string designates a module name and quotes it appropriately).
1881 2024
1882For example, to force the pure perl model (L<AnyEvent::Loop::Perl>) you 2025For example, to force the pure perl model (L<AnyEvent::Loop::Perl>) you
1883could start your program like this: 2026could start your program like this:
1884 2027
1885 PERL_ANYEVENT_MODEL=Perl perl ... 2028 PERL_ANYEVENT_MODEL=Perl perl ...

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines