This should not be happening. According to the documentation:
The run_modes() method may be called more than once. Additional
values passed into run_modes() will be added to the run-modes
table. In the case that an existing run-mode is re-defined, the
new value will override the existing value. This behavior might
be useful for applications which are created via inheritance from
another application, or some advanced application which modifies
its own capabilities based on user input.
Perhaps you have a version problem. This documentation has
$CGI::Application::VERSION set to 2.5.
Perhaps you also need to call SUPER::setup in your derived setup()
function.
As a last chance, you could also use the AUTOLOAD run mode, which works
"the same" as the AUTOLOAD function for blessed perl objects.
Brian
----
Brian T. Wightman
[EMAIL PROTECTED]
414.524.4025
Martijn.van.den.Bu
[EMAIL PROTECTED] To: [EMAIL PROTECTED]
cc:
03/25/03 02:35 AM Subject: [cgiapp] Super-class
question
Please respond to
Martijn.van.den.Bu
rg
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
--
+----------------------------------+
Martijn van den Burg
ASML, CS PPC [EMAIL PROTECTED] Systems
Voice: +31 (0)40 268 3856
+----------------------------------+
---------------------------------------------------------------------
Web Archive: http://www.mail-archive.com/[EMAIL PROTECTED]/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
Web Archive: http://www.mail-archive.com/[EMAIL PROTECTED]/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]