blib/lib/AnyEvent/Impl/EV.pm

filter: Statementstmt 48.4% 16 / 33 Branchbran 37.5% 3 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 26.6% 4 / 15 Podpod 0.0% 0 / 8 totaltotal 35.9% 23 / 64 CC 4 SCAR 8.8
CC
4
Cov
46%
io
6.0
__ANON__
3.2
time
2.0
CRAP 2.4
« blib/lib/AnyEvent/Impl/Perl.pm ↑ Summary blib/lib/AE.pm »
1 =head1 NAME
2  
3 AnyEvent::Impl::EV - AnyEvent adaptor for EV
4  
5 =head1 SYNOPSIS
6  
7 use AnyEvent;
8 use EV;
9
10 # this module gets loaded automatically as required
11  
12 =head1 DESCRIPTION
13  
14 This module provides transparent support for AnyEvent. You don't have to
15 do anything to make EV work with AnyEvent except by loading EV before
16 creating the first AnyEvent watcher.
17  
18 EV is the fastest event library for perl, and best supported by
19 AnyEvent. Most functions from the L<AE> API are implemented as direct
20 aliases to EV functions, so using EV via AE is as fast as using EV
21 directly.
22  
23 =cut
24  
25 package AnyEvent::Impl::EV;
26  
27 1 ▶use AnyEvent (); BEGIN { AnyEvent::common_sense }
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
28 1 ▶use EV 4.00;
Subroutine BEGIN: called CC=1 SCAR=0.0
29  
30 1 *AE::time = \&EV::time;
31 1 *AE::now = \&EV::now;
32 1 *AE::now_update = \&EV::now_update;
33 1 *AE::timer = \&EV::timer;
34 1 *AE::signal = \&EV::signal;
35 1 *AE::idle = \&EV::idle;
36  
37 # cannot override directly, as EV doesn't allow arguments
38 0 ▶sub time { EV::time }
Subroutine time: not called CC=1 SCAR=6.9
Pod undocumented
39 0 ▶sub now { EV::now }
Subroutine now: not called CC=1 SCAR=6.9
Pod undocumented
40 0 ▶sub now_update { EV::now_update }
Subroutine now_update: not called CC=1 SCAR=6.9
Pod undocumented
41  
42 *AE::io = defined &EV::_ae_io # 3.8+, but keep just in case it is dropped
43 ? \&EV::_ae_io
44 0 ▶ : sub($$$) { EV::io $_[0], $_[1] ? EV::WRITE : EV::READ, $_[2] };
Subroutine __ANON__: not called CC=2 SCAR=11.6
Branch: 2 branches
BranchTrueFalseTotal
$_[1] ? : 0 0 0
defined &EV::_ae_io ? : 1 0 1
45  
46 0 ▶sub timer {
Subroutine timer: not called CC=1 SCAR=6.9
Pod undocumented
47 0 my ($class, %arg) = @_;
48  
49 EV::timer $arg{after}, $arg{interval}, $arg{cb}
50 0 }
51  
52 0 ▶sub io {
Subroutine io: not called CC=2 SCAR=17.9
Pod undocumented
53 0 my ($class, %arg) = @_;
54  
55 EV::io
56 $arg{fh},
57 $arg{poll} eq "r" ? EV::READ : EV::WRITE,
58 $arg{cb}
59 0 ▶}
Branch: 1 branch
BranchTrueFalseTotal
$arg{'poll'} eq 'r' ? : 0 0 0
60  
61 0 ▶sub signal {
Subroutine signal: not called CC=1 SCAR=6.9
Pod undocumented
62 0 my ($class, %arg) = @_;
63  
64 EV::signal $arg{signal}, $arg{cb}
65 0 }
66  
67 0 ▶sub child {
Subroutine child: not called CC=1 SCAR=6.9
Pod undocumented
68 0 my ($class, %arg) = @_;
69  
70 0 my $cb = $arg{cb};
71  
72 0 ▶ EV::child $arg{pid}, 0, sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
73 0 $cb->($_[0]->rpid, $_[0]->rstatus);
74 }
75 0 }
76  
77 0 ▶sub idle {
Subroutine idle: not called CC=1 SCAR=6.9
Pod undocumented
78 0 my ($class, %arg) = @_;
79  
80 EV::idle $arg{cb}
81 0 }
82  
83 0 ▶sub _poll {
Subroutine _poll: not called CC=1 SCAR=6.9
84 0 EV::run EV::RUN_ONCE;
85 }
86  
87 2 ▶sub AnyEvent::CondVar::Base::_wait {
Subroutine _wait: called CC=2 SCAR=6.9
88 2 ▶ EV::run EV::RUN_ONCE until exists $_[0]{_ae_sent};
Branch: 1 branch
BranchTrueFalseTotal
exists $_[0]{"_ae_sent"} or do { &EV::run(2) } 2 4 6
89 }
90  
91 #sub loop {
92 # EV::run;
93 #}
94  
95 =head1 SEE ALSO
96  
97 L<AnyEvent>, L<EV>.
98  
99 =head1 AUTHOR
100  
101 Marc Lehmann <schmorp@schmorp.de>
102 http://anyevent.schmorp.de
103  
104 =cut
105  
106 1 1
107  
« blib/lib/AnyEvent/Impl/Perl.pm ↑ Summary blib/lib/AE.pm »