POE::Component::Server::TCP - accessing listener heap entries

[email protected] (Krishna K) Mon, 29 Aug 2011 18:20:15 -0700 (PDT)
Newsgroups perl.poe
Message-ID <[email protected]>
Hi,
    I am trying to debug an issue with POE::Component::Server::TCP where the client sessions do not get closed correctly when using POE::Component::Client::TCP (1.311/1.312) but work as expected when using 1.294.

    I am maintaining global variables to manage information on number of clients that are connected/disconnected by updating them in ClientConnected() and ClientDisconnected() methods, which I would like to avoid and use the main listener session's heap entry (connections) as presented in the documentation.

http://search.cpan.org/~rcaputo/POE/lib/POE/Component/Server/TCP.pm#HEAP_Members_for_Master_Listening_Sessions

Portion of code
==========

my $client_count = 0;
POE::Component::Server::TCP->new(
  Alias => "job_server",
  Port  => 32080,

  # Send the client a list of available commands when it connects.
  ClientConnected => sub {
    $client_count++;  },

  # Make sure the job is destroyed when the client exits.
  ClientDisconnected => sub {
    $client_count--;  },};

 I understand that I cannot access the master listener's heap by adding of the inline state handlers are added to the client sessions. Can you please show me some examples on how I can access connections entry from listener's heap.



Thanks,
Krishna