source: perl/lib/BarnOwl/AnyEvent.pm @ 21bab95

release-1.10release-1.8release-1.9
Last change on this file since 21bab95 was 21bab95, checked in by Nelson Elhage <nelhage@mit.edu>, 14 years ago
Fix some bugs in asedeno's AnyEvent implementation.
  • Property mode set to 100644
File size: 749 bytes
Line 
1use strict;
2use warnings;
3package BarnOwl::AnyEvent;
4use BarnOwl::Timer;
5
6sub io {
7    my ($class, %arg) = @_;
8    my $fd = fileno($arg{fh});
9    my $mode = $arg{poll};
10    my $cb = $arg{cb};
11    my $self = {cb => $cb,
12                mode => $mode,
13                fd => $fd };
14    bless($self, $class);
15    $self->{dispatch} = BarnOwl::add_io_dispatch($fd, $mode, $cb);
16    return $self;
17}
18
19sub BarnOwl::AnyEvent::io::DESTROY
20{
21    my ($self) = @_;
22    BarnOwl::remove_io_dispatch($self->{fd});
23}
24
25sub timer {
26    my ($class, %arg) = @_;
27    return BarnOwl::Timer->new(\%arg);
28}
29
30sub DESTROY { }
31
32# sub idle {
33#     my ($class, %arg) = @_;
34#     my $cb = $arg{cb};
35# }
36
37# sub child {
38#     my ($class, %arg) = @_;
39#     my $cb = $arg{cb};
40# }
41
421;
Note: See TracBrowser for help on using the repository browser.