Posting a delay to another session

The code will post $event to $other_session after $time seconds.

It does so by creating a temporary, unique state in the current session and removing that state when the delay is up. It uses a closure to hold the name of the delayed event so that you don't have to store the temporary name anywhere.

  my $temp = "DELAY".$UNIQUE++ ; 
  $poe_kernel->state( $temp, sub {
      $poe_kernel->post( $other_session => $event ); 
      $poe_kernel->state( $temp ); 
     } ); 
  $poe_kernel->delay( $temp, $time );

Note that this will prevent the kernel from exiting until the delay is up.