My main problem in getting to use POE was the documentation. I found it hard to find good documentation on the key concepts and how exactly to get to several POE-related arguments from within functions (it's non-standard way of passing arguments took me a little to get used to). In the end documentation is there, but IMHO hard to find and scattered all over the place (yes, I've read basically everything on the poe website, and perldoc).

This gets me thinking about a little overlay-layer for POE so you can get to HEAP, KERNEL through a hashref like:

sub blabla { my ($poe_args) = shift; $poe_args->{KERNEL}->yield("bla"); delete $poe_args->{HEAP}->job; }
And the use of ARG0, ARG1 ... to pass variables is a little weird to me. For instance an ErrorEvent handler receives 5 parameters that way (ARG0 to ARG4), from the manpage:
... as follows: ARG0 = the return value of syscall(), ARG1 = errno() - the numeric value of the error generated, ARG2 = error() - a descriptive for the given error, ARG3 = the wheel id, and ARG4 = the handle on which the error occurred (stdout, stderr, etc.)
whereas IMHO it would be more descriptive to have a hash with descriptive names, so you could do:
sub errorhandler { my ($poe_args) = shift; if ($poe_args->{ERRNO} == 2) { print $poe_args->{ERROR}; }; }
that way I didn't have to go to the manpage every time to see what ARG\d I'd need.

That being said, I still think POE is a great set of modules that I liked using, and will use more in the future.


In reply to Re: Why are people not using POE? by eXile
in thread Why are people not using POE? by johnnywang

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.