1 | =head1 NAME |
1 | =head1 NAME |
2 | |
2 | |
3 | AnyEvent - the DBI of event loop programming |
3 | AnyEvent - the DBI of event loop programming |
4 | |
4 | |
5 | EV, Event, Glib, Tk, Perl, Event::Lib, Irssi, rxvt-unicode, IO::Async, Qt |
5 | EV, Event, Glib, Tk, Perl, Event::Lib, Irssi, rxvt-unicode, IO::Async, Qt, |
6 | and POE are various supported event loops/environments. |
6 | FLTK and POE are various supported event loops/environments. |
7 | |
7 | |
8 | =head1 SYNOPSIS |
8 | =head1 SYNOPSIS |
9 | |
9 | |
10 | use AnyEvent; |
10 | use AnyEvent; |
11 | |
11 | |
… | |
… | |
1056 | Log the given C<$msg> at the given C<$level>. |
1056 | Log the given C<$msg> at the given C<$level>. |
1057 | |
1057 | |
1058 | Loads AnyEvent::Log on first use and calls C<AnyEvent::Log::log> - |
1058 | Loads AnyEvent::Log on first use and calls C<AnyEvent::Log::log> - |
1059 | consequently, look at the L<AnyEvent::Log> documentation for details. |
1059 | consequently, look at the L<AnyEvent::Log> documentation for details. |
1060 | |
1060 | |
|
|
1061 | If you want to sprinkle loads of logging calls around your code, consider |
|
|
1062 | creating a logger callback with the C<AnyEvent::Log::logger< function. |
|
|
1063 | |
1061 | =back |
1064 | =back |
1062 | |
1065 | |
1063 | =head1 WHAT TO DO IN A MODULE |
1066 | =head1 WHAT TO DO IN A MODULE |
1064 | |
1067 | |
1065 | As a module author, you should C<use AnyEvent> and call AnyEvent methods |
1068 | As a module author, you should C<use AnyEvent> and call AnyEvent methods |
… | |
… | |
1121 | |
1124 | |
1122 | |
1125 | |
1123 | =head1 OTHER MODULES |
1126 | =head1 OTHER MODULES |
1124 | |
1127 | |
1125 | The following is a non-exhaustive list of additional modules that use |
1128 | The following is a non-exhaustive list of additional modules that use |
1126 | AnyEvent as a client and can therefore be mixed easily with other AnyEvent |
1129 | AnyEvent as a client and can therefore be mixed easily with other |
1127 | modules and other event loops in the same program. Some of the modules |
1130 | AnyEvent modules and other event loops in the same program. Some of the |
1128 | come as part of AnyEvent, the others are available via CPAN. |
1131 | modules come as part of AnyEvent, the others are available via CPAN (see |
|
|
1132 | L<http://search.cpan.org/search?m=module&q=anyevent%3A%3A*> for |
|
|
1133 | a longer non-exhaustive list), and the list is heavily biased towards |
|
|
1134 | modules of the AnyEvent author himself :) |
1129 | |
1135 | |
1130 | =over 4 |
1136 | =over 4 |
1131 | |
1137 | |
1132 | =item L<AnyEvent::Util> |
1138 | =item L<AnyEvent::Util> |
1133 | |
1139 | |
… | |
… | |
1408 | if defined &{"$MODEL\::$_"}; |
1414 | if defined &{"$MODEL\::$_"}; |
1409 | } |
1415 | } |
1410 | |
1416 | |
1411 | _isa_set; |
1417 | _isa_set; |
1412 | |
1418 | |
|
|
1419 | # we're officially open! |
|
|
1420 | |
1413 | if ($ENV{PERL_ANYEVENT_STRICT}) { |
1421 | if ($ENV{PERL_ANYEVENT_STRICT}) { |
1414 | require AnyEvent::Strict; |
1422 | require AnyEvent::Strict; |
1415 | } |
1423 | } |
1416 | |
1424 | |
1417 | if ($ENV{PERL_ANYEVENT_DEBUG_WRAP}) { |
1425 | if ($ENV{PERL_ANYEVENT_DEBUG_WRAP}) { |
1418 | require AnyEvent::Debug; |
1426 | require AnyEvent::Debug; |
1419 | AnyEvent::Debug::wrap ($ENV{PERL_ANYEVENT_DEBUG_WRAP}); |
1427 | AnyEvent::Debug::wrap ($ENV{PERL_ANYEVENT_DEBUG_WRAP}); |
1420 | } |
1428 | } |
1421 | |
1429 | |
1422 | if (exists $ENV{PERL_ANYEVENT_DEBUG_SHELL}) { |
1430 | if (length $ENV{PERL_ANYEVENT_DEBUG_SHELL}) { |
1423 | require AnyEvent::Socket; |
1431 | require AnyEvent::Socket; |
1424 | require AnyEvent::Debug; |
1432 | require AnyEvent::Debug; |
1425 | |
1433 | |
1426 | my $shell = $ENV{PERL_ANYEVENT_DEBUG_SHELL}; |
1434 | my $shell = $ENV{PERL_ANYEVENT_DEBUG_SHELL}; |
1427 | $shell =~ s/\$\$/$$/g; |
1435 | $shell =~ s/\$\$/$$/g; |
1428 | |
1436 | |
1429 | my ($host, $service) = AnyEvent::Socket::parse_hostport ($shell); |
1437 | my ($host, $service) = AnyEvent::Socket::parse_hostport ($shell); |
1430 | $AnyEvent::Debug::SHELL = AnyEvent::Debug::shell ($host, $service); |
1438 | $AnyEvent::Debug::SHELL = AnyEvent::Debug::shell ($host, $service); |
1431 | } |
1439 | } |
|
|
1440 | |
|
|
1441 | # now the anyevent environment is set up as the user told us to, so |
|
|
1442 | # call the actual user code - post detects |
1432 | |
1443 | |
1433 | (shift @post_detect)->() while @post_detect; |
1444 | (shift @post_detect)->() while @post_detect; |
1434 | undef @post_detect; |
1445 | undef @post_detect; |
1435 | |
1446 | |
1436 | *post_detect = sub(&) { |
1447 | *post_detect = sub(&) { |