How do I get the responses from POE::Component::Client::HTTP?

203 Views Asked by At

My component

  POE::Component::Client::HTTP->spawn(
        Agent     => "MyScript/1.0",
        Alias     => 'browser',
        Timeout   => 60,
        FollowRedirects => 3,
  );

This is the event handler of another POE component from where the HTTP request is sent

 sub connected {
     my ($heap,$kernel) = @_[HEAP,KERNEL];
     my $request = POST 'http://mydomain.com', [qw(hello world this is my script)];
     $kernel->post('browser','request','response',$request);
   }

 sub response {
     print "I am inside the response handler!\n"; # It never reaches here
   }

I checked my Webserver logs and the HTTP request is sent correctly but it doesn't send the HTTP::Response object (or anything) to the response handler. What did I do wrong?

1

There are 1 best solutions below

0
On

Sorry, this question can be closed. I was supposed to create a POE::Session with the response handlers and call $kernel->post() from it's _start handler.