use POE qw(Component::Server::TCP Component::IRC); POE::Component::Server::TCP->new( Port => '9999', Address => '0.0.0.0', ClientInput => \&client_input, ); POE::Session->create( package_states => [ main => [qw(_start create_bot)], ], ); $poe_kernel->run(); sub create_bot { print "Starting bot in session: ", $_[SESSION]->ID(), "\n"; } sub _start { print "My session has id: ", $_[SESSION]->ID(), "\n"; $_[KERNEL]->alias_set("mine"); } sub client_input { $_[KERNEL]->post(mine => 'create_bot'); }