Hi,

it's been a while since I used POE and have some brain issues getting to grip with it (once again, heh).

I intend to use POE::Component::Client::TCP to grab some content off a server and I'd like to use methods calls. Now, when creating the client I specify a callback for 'Connected'.

How do I make the client call a method (i.e. 'connected' as shown below) so that I have $self available to call further methods?

I can't figure out how I can do this :(

Anyone refresh my mind again?




package Blah;

sub new
{
   ...

   return ($self);
}


sub grabSome
{
   my $self = shift;

   my $client = new POE::Component::Client::TCP(
      RemoteAddress => '127.0..0.1',
      RemotePort    => '10000',

      Connected    => \&??????,

      ...
   )
}


##
## Called by poco client tcp
##

sub connected
{
my ($self, $kernel, $heap, $session) = @_[OBJECT, KERNEL, HEAP, SESSION];

   ## got reference to $self, call methods on it:

   $self->someOtherMethod();
}


sub someOtherMethod
{
   my $self = shift;

   ...
}

Reply via email to