package My::App; use strict; use warnings; use base qw(CGI::Application); use CGI::Application::Plugin::DebugMessage; $_ = My::App->new; $_->debug('Abandon Ship!'); $_->run; sub cgiapp_init { my $self = shift; $self->mode_param('rm'); $self->run_modes([ 'login', 'AUTOLOAD' ]); } sub cgiapp_prerun { my ( $this, $rm ) = @_; eval { do { (); } }; if ($@) { $_->debug('Abandon Ship!'); } }