sub cgiapp_init
{
my $self = shift;
$self->SUPER::cgiapp_init(@_);
# set your additional runmodes
}
On Tue, 2003-03-25 at 00:35, Martijn van den Burg wrote:
> Hi,
>
> I use a base class to handle authentication for my application.
> It contains the cgiapp_init() and cgiapp_prerun() functions to read the
> user ID and to set up the database handle, and a setup() function which
> defines runmodes for 'accessdenied' and 'noconnection'.
>
> The derived class says: use base 'MyPackage::Session', and the base
> class ('Session') says 'use base 'CGI::Application'. I do not meddle
> with @ISA.
>
> When the cgi program runs it creates an instance of the 'derived' class,
> and then it calls cgiapp_init() and cgiapp_prerun() of the base class.
> So far so good. But when access must be denied I cannot change to the
> relevant runmode in the _base_ class, from within cgiapp_prerun(),
> with $self->prerun_mode('name_of_runmode_in_base_class').
>
> The error message is "No such run-mode 'noconnection'".
>
> It appears that the program looks in the _derived_ class for the runmode
> 'name_of_runmode_in_base_class'.
>
> How can I fix this? I'd prefer to have the 'accessdenied' stuff in the
> base class, so I can reuse it for other packages in the same
> application.
>
> Kind regards,
>
> Martijn
--
Shaun Guth <[EMAIL PROTECTED]>
signature.asc
Description: This is a digitally signed message part
--------------------------------------------------------------------- Web Archive: http://www.mail-archive.com/[EMAIL PROTECTED]/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
