On Fri, 2004-09-17 at 17:04, Cees Hek wrote:
> The extra hook you have added looks like it occurs immediately after the
> teardown hook. So it doesn't look like it realy adds a new location for a hook,
> since a simple teardown hook will do exactly the same thing.
This is true at first glance but, the way I see it the teardown hook is
part of a public interface that should only be implemented by the final
application package. The intended use of the of the module I'm
developing is like this:
package My::CGI::Application::Subclass;
use base 'CGI::Application';
sub cgiapp_init { do common stuff... }
sub cgiapp_finish { do common stuff... }
package Some::Future::Application
use base 'My::CGI::Application::Subclass';
sub setup { do application specific stuff... }
sub teardown { do application specific stuff... }
> Can you explain why you need this addition? Is it because you are already using
> the teardown hook elsewhere, hence you can't use it again? If so, then maybe we
> should bring up the multi hook patch that I supplied to the list quite a while
> ago. This would allow you to register multiple methods to each hook. So with
> that patch, you could reuse the teardown hook without risking it being
> overridden in a subclass.
Interesting, this is one of the things that my module would provide.
> Another solution is to just reuse the teardown method, and be sure to call
> $self->SUPER::teardown within any teardown method you create. This will walk up
> the inheritance tree and execute the teardown method of the superclass.
I thought about doing this but then it puts the onus of remembering to
call SUPER::teardown on the subclassor. The idea behind what I'm working
on is to make a more extensible drop in replacement for
CGI::Application. I may subclass this module 6 months from now or it may
get published to CPAN and then every one that uses it has to remember to
SUPER::teardown
Maybe I should package up what I have so far and see what people think.
I'm going to use it in a project I'm working on regardless but I was
thinking about publishing it eventually anyway.
--
Tony Fraser
[EMAIL PROTECTED]
Sybaspace Internet Solutions System Administrator
phone: (250) 246-5368 fax: (250) 246-5398
---------------------------------------------------------------------
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]