[英]How do I get the responses from POE::Component::Client::HTTP?
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 这是发送HTTP请求的另一个POE组件的事件处理程序
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. 我检查了Web服务器日志,并正确发送了HTTP请求,但没有将HTTP :: Response对象(或其他任何对象)发送到响应处理程序。 What did I do wrong? 我做错了什么?
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. 我应该用响应处理程序创建一个POE :: Session并从它的_start处理程序中调用$ kernel-> post()。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.