"Jamie Krasnoo" <[EMAIL PROTECTED]> wrote on 11/17/2006 02:15:01 PM:
> Ok I have a quick question on setup when you're sub classing CGI::App.
>
> If I want to be able to specify standard run modes, and mode_params
> without having to overload the setup function each time I use it. How
> does that work?
I do this with hooks ...
package SuperApp;
use strict;
use warnings;
use base 'CGI::Application';
SuperApp->add_callback('init', \&sa_hook_init);
sub sa_hook_init {
my $self = shift;
my @args = shift;
# supply a global error handler
$self->run_modes(
'error' => 'do_error'
);
# set the default error handler
$self->error_mode('do_error');
}
Then, in the sub modules:
use base 'SuperApp';
instead of
use base 'CGI::Application';
Todd Ross
---------------------------------------------------------------------
Web Archive: http://www.mail-archive.com/[email protected]/
http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]