Hi Monks, From couple of days, I am doing some research about POE which seems a good candidate to solve my problem.
After searching a lot and trying from code from cookbook Yet not clear on how to write my code can some please help me with sample.
here is what I am looking for.
package MyPackage; while(1) { fetch_data(); send_to_poe(); <<< this how & where I want to send to POE. so th +at while loop can process it should not wait for reply as it don't ne +ed reply so can say an async call }

There will be a script running in an infinite loop that will never end. eg I found this but now want to add own sub that will so that once I receive the event from above code. I can process in the background. How can I add new handler in the following code will a new key eg _my_function => \&get_work_done will work. Sorry completely new to POE concept.
POE::Session->create( inline_states => { _start => sub { $_[KERNEL]->yield("next") }, next => sub { print "listening...\n"; $_[KERNEL]->delay(next => 1); }, }, ); POE::Kernel->run(); # exit

* I wish to run a script in continue never-ending loop unless user kills it lets call it Worker.
* want to send some work i.e few parameters to worker eg host and command.

In reply to Need help in getting started with POE by smarthacker67

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.