Michael wrote:
Cees Heek wrote:
Yes, except that in your subclass example, the fact that you create a
new 'cgiapp_init' method will override the 'cgiapp_init' method in
your base class. That means the 'cgiapp_init' method in your base
class will not get executed. That may be desired, but if it is not,
then you can call the 'cgiapp_init' method in the base class directly
by adding the following line to your 'cgiapp_init' method in your
subclass:
$self->SUPER::cgiapp_init(@_);
Or you can do what I've been doing lately and just have your base
class
use the callback system to register it's init code. This makes it
easier
for your subclasses since they even have to know that the base class
want's to do anything at init time.
$self->add_callback(init => \&_my_init);
This won't work well however if you want to override your base's
init in
the child class. Just another way to do it :)
And for yet another way :-)
It's probably not best practices, but what I do is implement the
cgiapp_init, setup, etc. in the base class. Each of them makes a
call to a my_init, my_setup, etc. I stub those out in the base
class. Then my subclasses can implement those without overriding the
base methods. If they still really need to override, that is
available too.
Depending on what I intend the subclasses to actually do in the "my"
methods, I put the call at the beginning, in the middle, or at the
end of the base method.
Jaclyn
---------------------------------------------------------------------
Web Archive: http://www.mail-archive.com/cgiapp@lists.erlbaum.net/
http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]