in reply to Re^2: POE::Wheel::ReadWrite: "low priority" events
in thread POE::Wheel::ReadWrite: "low priority" events

You could implement the Chain of Responsibility design pattern by promoting ARG0 from an input string to a data structure that includes the input and the steps to process it.

First define a subroutine to pass the job to the next step in the recipe:

sub what_next { my ($kernel, $job) = @_; my $next_step = shift @{ $job->{recipe} }; if (defined $next_step) { $kernel->yield( $next_step => $job ); } else { $kernel->yield( 'process_next_input' ); } }

process_next_input() builds the job and the initial recipe, and then uses what_next() to start the process:

sub process_next_input { ...; my $job = { input => $next_input, recipe => [ 'step_one', 'step_two' ], }; what_next($_[KERNEL], $job); }

All stages of the process end by calling what_next() to pass the work on. You could get fancy by pushing coderefs onto the recipe that conditionally return the next event in the chain.

Sorry for not responding in so long. I'm doing PerlMonks wrong, and I don't notice my message inbox until I actively return to the site. If there's some sort of RSS-like way to check for messages, that would help a lot.

Replies are listed 'Best First'.
Re^4: POE::Wheel::ReadWrite: "low priority" events
by jdporter (Paladin) on Jun 24, 2012 at 22:32 UTC
    I don't notice my message inbox until I actively return to the site.

    That's the way PerlMonks works; you're not doing it wrong. Unfortunately we don't (yet) have any other way of notifying users of events of interest, e.g. via email.

    If there's some sort of RSS-like way to check for messages, that would help a lot.

    Or that. :-)

    I reckon we are the only monastery ever to have a dungeon stuffed with 16,000 zombies.