| 1 | =head1 NAME | ||||||||||
| 2 | |||||||||||
| 3 | AnyEvent::Impl::Perl - AnyEvent adaptor for AnyEvent's pure perl AnyEvent::Loop | ||||||||||
| 4 | |||||||||||
| 5 | =head1 SYNOPSIS | ||||||||||
| 6 | |||||||||||
| 7 | use AnyEvent; | ||||||||||
| 8 | use AnyEvent::Loop; | ||||||||||
| 9 | # this module gets loaded automatically as required | ||||||||||
| 10 | |||||||||||
| 11 | =head1 DESCRIPTION | ||||||||||
| 12 | |||||||||||
| 13 | This module provides transparent support for AnyEvent in case no other | ||||||||||
| 14 | event loop could be found or loaded. | ||||||||||
| 15 | |||||||||||
| 16 | If you want to use this module instead of autoloading another event loop | ||||||||||
| 17 | you can simply load L<AnyEvent::Loop> before creating the first watcher. | ||||||||||
| 18 | |||||||||||
| 19 | Naturally, it supports all features of AnyEvent. | ||||||||||
| 20 | |||||||||||
| 21 | See L<AnyEvent::Loop> for more details on performance characteristics. | ||||||||||
| 22 | |||||||||||
| 23 | =cut | ||||||||||
| 24 | |||||||||||
| 25 | package AnyEvent::Impl::Perl; | ||||||||||
| 26 | |||||||||||
| 27 | 3 | ▶ | use AnyEvent (); BEGIN { AnyEvent::common_sense } | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 28 | 3 | ▶ | use AnyEvent::Loop; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 29 | |||||||||||
| 30 | 3 | our $VERSION = $AnyEvent::VERSION; | |||||||||
| 31 | |||||||||||
| 32 | # time() is provided via AnyEvent::Base | ||||||||||
| 33 | |||||||||||
| 34 | 3 | *AE::now = \&AnyEvent::Loop::now; | |||||||||
| 35 | 3 | *AE::now_update = \&AnyEvent::Loop::now_update; | |||||||||
| 36 | 3 | *AE::io = \&AnyEvent::Loop::io; | |||||||||
| 37 | 3 | *AE::timer = \&AnyEvent::Loop::timer; | |||||||||
| 38 | 3 | *AE::idle = \&AnyEvent::Loop::idle; | |||||||||
| 39 | 3 | *_poll = \&AnyEvent::Loop::one_event; | |||||||||
| 40 | 3 | *loop = \&AnyEvent::Loop::run; # compatibility with AnyEvent < 6.0 | |||||||||
| 41 | 3 | *now_update = \&AnyEvent::Loop::now_update; | |||||||||
| 42 | |||||||||||
| 43 | 0 | ▶ | sub now { $AnyEvent::Loop::NOW } | ||||||||
|
Subroutine
now: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 44 | |||||||||||
| 45 | 0 | ▶ | sub AnyEvent::CondVar::Base::_wait { | ||||||||
|
Subroutine
_wait: not called CC=2 SCAR=17.9
| |||||||||||
| 46 | 0 | ▶ | AnyEvent::Loop::one_event until exists $_[0]{_ae_sent}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 47 | } | ||||||||||
| 48 | |||||||||||
| 49 | 0 | ▶ | sub io { | ||||||||
|
Subroutine
io: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 50 | 0 | my (undef, %arg) = @_; | |||||||||
| 51 | |||||||||||
| 52 | AnyEvent::Loop::io $arg{fh}, $arg{poll} eq "w", $arg{cb} | ||||||||||
| 53 | 0 | } | |||||||||
| 54 | |||||||||||
| 55 | 1 | ▶ | sub timer { | ||||||||
|
Subroutine
timer: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 56 | 1 | my (undef, %arg) = @_; | |||||||||
| 57 | |||||||||||
| 58 | AnyEvent::Loop::timer $arg{after}, $arg{interval}, $arg{cb} | ||||||||||
| 59 | 1 | } | |||||||||
| 60 | |||||||||||
| 61 | 0 | ▶ | sub idle { | ||||||||
|
Subroutine
idle: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 62 | 0 | my (undef, %arg) = @_; | |||||||||
| 63 | |||||||||||
| 64 | AnyEvent::Loop::idle $arg{cb} | ||||||||||
| 65 | 0 | } | |||||||||
| 66 | |||||||||||
| 67 | =head1 SEE ALSO | ||||||||||
| 68 | |||||||||||
| 69 | L<AnyEvent>. | ||||||||||
| 70 | |||||||||||
| 71 | =head1 AUTHOR | ||||||||||
| 72 | |||||||||||
| 73 | Marc Lehmann <schmorp@schmorp.de> | ||||||||||
| 74 | http://anyevent.schmorp.de | ||||||||||
| 75 | |||||||||||
| 76 | =cut | ||||||||||
| 77 | |||||||||||
| 78 | 3 | 1 | |||||||||
| 79 | |||||||||||