ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/AnyEvent/lib/AnyEvent/Impl/Event.pm
Revision: 1.26
Committed: Thu Feb 5 01:31:04 2009 UTC (15 years, 5 months ago) by root
Branch: MAIN
CVS Tags: rel-4_352, rel-4_351, rel-4_34, rel-4_35
Changes since 1.25: +1 -1 lines
Log Message:
*** empty log message ***

File Contents

# User Rev Content
1 root 1.16 =head1 NAME
2    
3     AnyEvent::Impl::Event - AnyEvent adaptor for Event
4    
5     =head1 SYNOPSIS
6    
7 root 1.21 use AnyEvent;
8 root 1.25 use Event;
9 root 1.21
10     # this module gets loaded automatically as required
11 root 1.16
12     =head1 DESCRIPTION
13    
14     This module provides transparent support for AnyEvent. You don't have to
15     do anything to make Event work with AnyEvent except by loading Event before
16     creating the first AnyEvent watcher.
17    
18 root 1.24 The event module is reasonably efficient and generally works correctly
19     even with many watchers.
20    
21 root 1.16 =cut
22    
23 root 1.1 package AnyEvent::Impl::Event;
24    
25 root 1.12 no warnings;
26 root 1.15 use strict;
27 root 1.12
28 root 1.20 use AnyEvent ();
29 root 1.19
30 root 1.26 use Event qw(time); # we have to importt something to make Event use Time::HiRes
31 root 1.1
32 root 1.2 sub io {
33     my ($class, %arg) = @_;
34     $arg{fd} = delete $arg{fh};
35 root 1.20 $arg{poll} .= "e" if AnyEvent::WIN32; # work around windows connect bug
36 root 1.13 bless \(Event->io (%arg)), $class
37 root 1.2 }
38    
39     sub timer {
40     my ($class, %arg) = @_;
41 root 1.23 bless \Event->timer (%arg, repeat => $arg{interval}), $class
42 root 1.2 }
43    
44 root 1.13 sub signal {
45     my ($class, %arg) = @_;
46 root 1.18 bless \Event->signal (%arg), $class
47 root 1.13 }
48    
49 root 1.7 sub DESTROY {
50 root 1.9 ${$_[0]}->cancel;
51 root 1.1 }
52    
53 root 1.11 sub one_event {
54     Event::one_event;
55 root 1.1 }
56    
57 root 1.16 1;
58    
59     =head1 SEE ALSO
60    
61 root 1.17 L<AnyEvent>, L<Event>.
62 root 1.16
63     =head1 AUTHOR
64    
65     Marc Lehmann <schmorp@schmorp.de>
66     http://home.schmorp.de/
67    
68     =cut
69 root 1.1