in reply to Cutting repetition in POE coding

sub check_cond { my $callback = shift; my $kernel = shift; my $session = shift; my $result = $callback->(); if ($result) { $kernel->post( $session, event => @_ ); } return $result; } # then check_cond(sub { 2 > 1 }, $kernel, $session, @args) and return;

Replies are listed 'Best First'.
Re^2: Cutting repetition in POE coding
by halley (Prior) on Nov 26, 2005 at 16:08 UTC
    Your sub name, check_condition(), does not imply to the reader that there is a side-effect, namely, posting an event to the kernel.

    --
    [ e d @ h a l l e y . c c ]