release-1.10release-1.8release-1.9
|
Last change
on this file since 0b20de4 was
0b20de4,
checked in by Nelson Elhage <nelhage@nelhage.com>, 16 years ago
|
|
First pass at AnyEvent.
Implementing io and timer.
Not implementing child or idle.
|
-
Property mode set to
100644
|
|
File size:
731 bytes
|
| Line | |
|---|
| 1 | use strict; |
|---|
| 2 | use warnings; |
|---|
| 3 | package BarnOwl::AnyEvent; |
|---|
| 4 | use BarnOwl::Timer; |
|---|
| 5 | |
|---|
| 6 | sub 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 | |
|---|
| 19 | sub BarnOwl::AnyEvent::io::DESTROY |
|---|
| 20 | { |
|---|
| 21 | my ($self) = @_; |
|---|
| 22 | BarnOwl::remove_io_dispatch($self->{fd}); |
|---|
| 23 | } |
|---|
| 24 | |
|---|
| 25 | sub timer { |
|---|
| 26 | my ($class, %arg) = @_; |
|---|
| 27 | return BarnOwl::Timer->new(%args); |
|---|
| 28 | } |
|---|
| 29 | |
|---|
| 30 | # sub idle { |
|---|
| 31 | # my ($class, %arg) = @_; |
|---|
| 32 | # my $cb = $arg{cb}; |
|---|
| 33 | # } |
|---|
| 34 | |
|---|
| 35 | # sub child { |
|---|
| 36 | # my ($class, %arg) = @_; |
|---|
| 37 | # my $cb = $arg{cb}; |
|---|
| 38 | # } |
|---|
| 39 | |
|---|
| 40 | 1; |
|---|
Note: See
TracBrowser
for help on using the repository browser.