ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Net-FCP/FCP/Event/Event.pm
Revision: 1.1
Committed: Wed Sep 10 04:50:45 2003 UTC (23 years ago) by root
Branch: MAIN
Log Message:
*** empty log message ***

File Contents

# User Rev Content
1 root 1.1 package Net::FCP::Event::Event;
2    
3     require Event;
4    
5     sub new_from_fh {
6     my ($class, $fh) = @_;
7     bless \(my $x = Event->io (
8     fd => $fh,
9     poll => 'e',
10     cb => sub { die "no callback set for watcher" },
11     )), $class;
12     }
13    
14     sub cb {
15     my ($self, $cb) = @_;
16     $$self->cb ($cb);
17     $self;
18     }
19    
20     sub poll {
21     my ($self, $r, $w, $e) = @_;
22     $$self->poll (
23     ($r ? "r" : "") .
24     ($w ? "w" : "") .
25     ($e ? "e" : "")
26     );
27     $self;
28     }
29    
30     sub DESTROY {
31     my ($self) = @_;
32    
33     $$self->cancel;
34     }
35    
36     #############
37    
38     sub new_signal {
39     my $class = shift;
40    
41     bless \my $x, $class;
42     }
43    
44     sub send {
45     # nop
46     }
47    
48     sub wait {
49     Event::one_event();
50     }
51    
52     1;
53