I know this isn't a CGI::App based solution for your problem, but consider WWW::Pipeline's (a subclass of Application::Pipeline) solution to adding a new hook. It's as simple as adding entries to an array in the appropriate slot of a hash called the %plan. Here's the superclass' plan:

our %plan = (
   Initialization => [ \&_setup ],
   Teardown => [ \&_closeSession ]
);

And here's the subclass' plan:

our %plan = (
   Initialization => [ 'SUPER', \&_setup ],
   ParseRequest   => [ \&_parseRequest, \&_authRequest ],
);

When both the superclass and subclass have methods for a certain phase of the plan, the SUPER keyword in the subclass indicates where to inject the superclass' methods into the phase. Leaving that keyword out means that the subclass intends to replace the superclass' methods rather than supplement them, for that phase. A phase not in the subclass but in the superclass will be executed as specified by the superclass, unless the subclass explicitly sets an empty arrayref for that phase.

Using the RunMode plugin gives most of the application development under WWW::Pipeline a very CGI::App feel.

-Stephen

---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/[EMAIL PROTECTED]/
             http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to