in reply to POE: Passing data from Session to Queue to New Session

Will the args or heap parameter to POE::Session->create() be enough? That will let you pass $message into the session's _start handler.

  • Comment on Re: POE: Passing data from Session to Queue to New Session

Replies are listed 'Best First'.
Re^2: POE: Passing data from Session to Queue to New Session
by Devanchya (Beadle) on Sep 02, 2008 at 17:08 UTC
    This has been edited since I found my issue. Yes passing the Args works. I needed to change how I thought of the args:
    sub make_a_worker { my ( $postback, $message ) = @_; POE::Session->create( inline_states => { _start => \&start_message_process, process_message => \&process_message, delay_test => \&delay_test, _end => \&end_message_process, }, args => [ $message ], ); } sub start_message_process { my ($kernel, $session, $heap, @args) = @_[KERNEL, SE +SSION, HEAP, ARG0 .. $#_ ]; $kernel->yield( process_message => $postargs->[0] ); }
    This appears to work. I will confirm on my end with a longer example.
    Even smart people are dumb in most things...