my %plugins; POE::Component::Server::TCP->new( Alias => 'TCPServer', Port => 53511, ClientInput => sub { my $input = $_[ARG0]; foreach my $plugin (keys %plugins) { send_input_to_plugin($input, $plugin); } }, ); POE::Session->create( inline_states => { _start => sub { $plugins{$_[SESSION]->ID} = 1 }, _stop => sub { delete $plugins{$_[SESSION]->ID} }, } ); POE::Kernel->run(); exit;