简体   繁体   English

如何获得POE :: Component :: Client :: HTTP的响应?

[英]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.

相关问题 (Perl / POE)在POE :: Component :: IRC中,如何从外部子例程中的package_state返回/获取数据? - (Perl/POE) In POE::Component::IRC, How do you return/get data from a package_state in an external subroutine? 使用POE :: Component :: Client :: HTTP的用户身份验证 - User authentication using POE::Component::Client::HTTP 如何使用Perl的POE :: Component :: IRC发出退出消息? - How do I issue a quit message with perl's POE::Component::IRC? 如何正确关闭Bot :: BasicBot bot(基于POE :: Component :: IRC)? - How do I correctly shutdown a Bot::BasicBot bot (based on POE::Component::IRC)? 如何在Perl中使用POE :: Component :: IRC :: State检查用户是否已通过NickServ进行身份验证? - How do I check if a user is authenticated with NickServ using POE::Component::IRC::State in Perl? 如何设置POE :: Filter来接收服务器返回的全部数据? - How do I set up my POE::Filter to receive the entire chunk of data returned from the server? 如何将数组放在POE堆上并推送或弹出数据? - How do I put an array on the POE heap and push or pop data? POE:自定义POE :: Component中的周期性服务器警报 - POE: recurring server Alarms in a custom POE::Component 是否有可能让POE :: Component :: IRC接收自己的PRIVMSG事件? - Is it possible to get POE::Component::IRC to receive events for its own PRIVMSGs? POE :: Component :: IRC,请求后如何预见动作? - POE::Component::IRC, how to anticipate an action after requesting it?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM