Hi, I have a poe component tcp server and a session. I need to send updates from the session to the server. here is a sample I used that didn't work:
#!/usr/bin/perl -w use strict; use YAML; sub POE::Kernel::ASSERT_DEFAULT () { 1 } use POE; use POE::Component::Server::TCP; use POE::Filter::Reference; POE::Component::Server::TCP->new(Alias => 'TOF', Port => 2222, ClientFilter => ['POE::Filter::Reference'], ClientInput => \&client_input, InlineStates => {Update_clients => \&update_clients, }, ); POE::Session->create(inline_states => {_start => \&_start, Send_updates => \&send_update, _stop => \&_stop, }, ); POE::Kernel->run(); exit; sub client_input { my $input = $_[ARG0]; print 'my input = ' . YAML::Dump($input); } sub update_clients { my $update = $_[ARG0]; print 'my update is ' . YAML::Dump($update); } sub _start { my $kernel = $_[KERNEL]; print "session started\n"; $kernel->yield('Send_update'); } sub send_update { my $kernel = $_[KERNEL]; my $update = {Header => 'update', Msg => 'Hello Server', }; $kernel->post('TOF', 'Update_clients', $update); $kernel->delay('Send_update', 10); } sub _stop { print "session end\n"; }
this is the output_errors I get when I run it: session started a 'Update_clients' event was sent from talk_from_session_to_server.pl at 53 to session 2 (TOF) but session 2 (TOF) has neither a handler for it nor one for _default what am I doing wrong? thanks for the help

In reply to POE: post an event on tcp server from a session by tsvikt

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.