>> Brett, I think this existing functionality would provide what you want:
>>
>>   PSGI::Application->new_hook('authorization');
>>   PSGI::Application->add_callback('authorization', \&callback);
>
> Kind of, but what it doesn't allow me to do is affect the order in
> which the lifecycle hooks are executed.  I think that I would also
> have to make a ->call_hook('authorization'), when what I really want
> to do is not only create the 'authorization' hook, but add it as a
> bona-fide lifecycle event like 'init', 'prerun', etc and choose at
> what point after 'init' is executed.

I see the difference. You still want the ability to decide where within
"run" the hook point is fired from.

> So, maybe something like this:
>
>   PSGI::Application->new_hook('authorization','before','prerun');
>   PSGI::Application->add_callback('authorization', \&callback);

Then you need one more piece:

   before 'prerun' => sub {
       my ($self,@args) = @_;
       $self->call_hook('authorization', @args);
   }

"before" is a method modifier provided by Moose and Mouse. Since
PSGI::Application uses Any::Moose, it will always be available for use.

The pieces can be wrapped up in an Authorization plugin for those who
want to use it.

Once that's done, there's no more calling "call_hook()" explicitly, just
use the authorization plugin.

     Mark

#####  CGI::Application community mailing list  ################
##                                                            ##
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp    ##
##                                                            ##
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:          http://cgiapp.erlbaum.net/                 ##
##                                                            ##
################################################################

Reply via email to