ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/AnyEvent/lib/AnyEvent/Impl/Perl.pm
Revision: 1.104
Committed: Mon Apr 9 02:25:48 2012 UTC (12 years, 2 months ago) by root
Branch: MAIN
CVS Tags: rel-7_05, rel-7_01, rel-7_02, rel-7_03, rel-7_0, rel-7_04
Changes since 1.103: +1 -1 lines
Log Message:
*** empty log message ***

File Contents

# Content
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 use AnyEvent (); BEGIN { AnyEvent::common_sense }
28 use AnyEvent::Loop;
29
30 our $VERSION = $AnyEvent::VERSION;
31
32 # time() is provided via AnyEvent::Base
33
34 *AE::now = \&AnyEvent::Loop::now;
35 *AE::now_update = \&AnyEvent::Loop::now_update;
36 *AE::io = \&AnyEvent::Loop::io;
37 *AE::timer = \&AnyEvent::Loop::timer;
38 *AE::idle = \&AnyEvent::Loop::idle;
39 *_poll = \&AnyEvent::Loop::one_event;
40 *loop = \&AnyEvent::Loop::run; # compatibility with AnyEvent < 6.0
41
42 sub now { $AnyEvent::Loop::NOW }
43 sub now_update { AE::now_update }
44
45 sub AnyEvent::CondVar::Base::_wait {
46 AnyEvent::Loop::one_event until exists $_[0]{_ae_sent};
47 }
48
49 sub io {
50 my (undef, %arg) = @_;
51
52 AnyEvent::Loop::io $arg{fh}, $arg{poll} eq "w", $arg{cb}
53 }
54
55 sub timer {
56 my (undef, %arg) = @_;
57
58 AnyEvent::Loop::timer $arg{after}, $arg{interval}, $arg{cb}
59 }
60
61 sub idle {
62 my (undef, %arg) = @_;
63
64 AnyEvent::Loop::idle $arg{cb}
65 }
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 1
79