The way I usually do this sort of thing is place the following in the base class:
package BaseClass; use base 'CGI::Application'; sub cgiapp_init { my $self = shift; $self->run_modes('mode1_common' => \&mode1_common, 'mode2_common' => \&mode2_common); }
Then in the derived class I have the standard:
package DerivedClass; use base 'BaseClass'; sub setup { my $self = shift; $self->start_mode('start'); $self->run_modes([qw(derived_mode1 derived_mode2)]); }
As the CGI::Application documentation for cgiapp_init states:
If implemented, this method is called automatically right before
the setup() method is called. This method provides an optional
initialization hook, which improves the object-oriented character-
istics of CGI::Application. The cgiapp_init() method receives, as
its parameters, all the arguments which were sent to the new()
method.
In reply to Re: CGI::Application and inheritance
by Belgarion
in thread CGI::Application and inheritance
by geektron
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |