title: POE::Kernel->run() takes around 15 seconds to stop/
body: <p>This is my code, have redacted the "use" statements. They all are working as desired.</p>
  
  <pre><code>my $json_data;
  
  sub request {
      my ( $method, $container, $params, $content_type) = @_;
  
      #get the complete URL, works fine
      my $full_url = get_url( $method, $container, $params, $content_type);
  
      POE::Component::Client::HTTP-&gt;spawn(Alias =&gt; 'ua');
  
      # Start a session that will drive the resolver.
      # Callbacks are named functions in the "main" package.
      POE::Session-&gt;create(
      inline_states =&gt; {
          _start       =&gt; \&amp;_start,
          got_response =&gt; \&amp;got_response,
          }
      );
  
      POE::Kernel-&gt;run();
      return $json_data;
  }
  
  sub _start {
      my $kernel = $_[KERNEL];
      $kernel-&gt;post("ua" =&gt; "request", "got_response", $full_url);
  }
  
  sub got_response {
      my ($response_packet) = $_[ARG1];
  
      my $http_response = $response_packet-&gt;[0];
      my $response_string = $http_response-&gt;decoded_content();
      $json_data = decode_json( $response_string);
      print Dumper $json_data;
  }
  </code></pre>
  
  <p>The Dumper in <strong>got_response</strong> prints the value instantly, but after that I have to wait at least 15 seconds for the return statement after <strong>POE::Kernel->run</strong> to execute. It returns the correct value but I can't wait that long.
  If I add exit after the <strong>sub get_reponse dumper</strong> statement, then no value is returned.</p>
  
  <p>Any help and suggestion will be appreciated.</p>