For some reason......when I execute the find method, which should really
execute the '_process_request' method the find isn't replaced with a
reference to _process_request

#############  CODE ATTEMPT #########
my $session = $class->__spawn({easyDBI_alias => 'easydbi_alias'});
$kernel->post('PoeDevice', find => { id => 1, find_event =>
\&my_method_handler } );
######################################

## find and any keys of %command should all be mapped to _process_request
but they aren't  any ideas why?
sub __spawn {

    my $class = shift;
    my %exp_commands = map { $_ => 1 } qw(find);
    my $session = POE::Session->create(

        package_states =>
          [
             (__PACKAGE__) => [
                 '_start' => '_start',
                 '_stop'  => '_stop',
                 (map { $_ => '_process_request' } keys %COMMANDS)
             ],
             ($class)       => [
                 'find' => '_process_request'
             ]

          ],
        ## pass args into _start:
        args => [...@_],
        heap => {
            class => $class
        },

    );

    return $session;

}

Reply via email to