Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Why are people not using POE?

by eXile (Priest)
on Jun 10, 2005 at 14:55 UTC ( [id://465570]=note: print w/replies, xml ) Need Help??


in reply to Why are people not using POE?

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.

Replies are listed 'Best First'.
Re^2: Why are people not using POE?
by rcaputo (Chaplain) on Jun 10, 2005 at 20:14 UTC

    It's not easy to write a standard object model that conceptually scales to infinity. I try it about once a year anyway. Each attempt starts with a small set of rules, but their corollaries invariably reach a point where complex applications can't be written. Check out my graveyard of past attempts to see for yourself.

    This year's try started off with more modest goals. That didn't prevent the first two attempts from veering off into WTF?! Land. Luckily the third try's taking much longer to go there.

    You might like this one. It almost totally abstracts POE::Kernel and POE::Session behind what's so far a small class library. To be sure, its size is a function of its incompleteness rather than its tidiness, but I think it's one of my best attempts to date.

    And you'll be happy about its calling convention, which is hash-based rather than using Perl's standard @_ array for parameters. You may not be happy with the choice of parameter (and other) names, but I'm open to suggestions. Keep in mind: This is prototypical code, so it's all subject to change as better ideas come up.

Re^2: Why are people not using POE?
by kscaldef (Pilgrim) on Jun 10, 2005 at 17:54 UTC
    It's a conscious decision not to use a hash. Why? Because it's considerably slower. You may say, "bah! who cares?" or some other variant of the "performance doesn't matter, and if it does switch to C" school of thought, but the POE designers disagree (and I tend to agree with them.) The point is that in writing library code, you don't want to arbitrarily limit the performance of the code. Put another way, you never want your framework to be the performance bottleneck for your application.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://465570]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2024-04-20 02:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found