On Tue, 25 Mar 2003, 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').

In my base class that subclasses C::A
I have the subs declared eg 'noconnection';

Then in my application class I set up as run modes the 
ones I want to use in this application.

        $self->run_modes(
                'mode1' => 'showlist',
                'mode2' => 'showdetail',
                'denied'  => 'accessdenied', 
                'noconnection' => 'noconnection',
        );

This seems to work just fine for me.

Clayton


---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/[EMAIL PROTECTED]/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to