To answer my own question......always helps to read the
documentation.......I was using the [ ]  shorthand form which maps identical
names

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

SHOULD BE:

 (__PACKAGE__) => {
                 '_start' => '_start',
                 '_stop'  => '_stop',

                 (map { $_ => '_process_request' } keys %COMMANDS)
             },
             ($class)       => {
                 'find' => '_process_request'
             }



On Thu, May 7, 2009 at 9:56 PM, Josh803316 <[email protected]> wrote:

> 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