Re: NetServer::Portal 1.04

[email protected] (Graham Barr)
Newsgroups perl.loop
Message-ID <[email protected]>
Great I will take a look at this. I would have to look at the code
to see I what I currently do still works, but you might want to
think about adding this.

We have several daemons which have a command interface via a socket.
I did not what to have to create a new socket for NetServer::ProcessTop 
so I did this.


package MyDaemon::Top;

use vars qw(@ISA);

@ISA = qw(NetServer::ProcessTop::Client);

sub new {
  my($pkg,$sock) = @_;
  require NetServer::ProcessTop;
  bless {
    from  => $sock->peerhost,
    sock  => $sock,
   }, $pkg;
}

sub cancel {
  my $o = shift;
  $o->{io}->cancel;
  Event::Stats::collect(-1);
  $cdata{$o->{sock}}->{rev}->start;
}


I could not just overload as new() wanted to create a socket and cancel()
closed it. What this allowed me todo was have a command which started
the proess in an existing connection, then return control to my
own handlers when top was exited.

Graham.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.