package My::MyApp;
use strict;
use warnings;
use base 'CGI::Application';
use CGI::Application::Plugin::Session;
use CGI::Application::Plugin::Authentication;
use CGI::Application::Plugin::Redirect;
use CGI::Application::Plugin::Forward;
use CGI::Application::Plugin::DebugScreen;
use CGI::Application::Plugin::ValidateRM;
use CGI::Application::Plugin::ConfigAuto qw/cfg/;
use CGI::Application::Plugin::HtmlTidy;
use Data::Dumper qw/Dumper/;
$Data::Dumper::Sortkeys = 1;
sub setup {
my $self = shift;
$self->start_mode('mode1');
$self->mode_param('rm');
$self->run_modes(
'mode1' => 'do_stuff',
'protected' => 'geschuetzt',
);
$self->param('CMS' => $self->query->url(-full=>1,));
} # /setup
sub cgiapp_init {
my $self = shift;
# Set some defaults for DFV unless they already exist.
$self->param('dfv_defaults') ||
$self->param('dfv_defaults', {
missing_optional_valid => 1,
filters => 'trim',
msgs => {
any_errors => 'FehlerLoop',
prefix => 'Error_',
invalid => 'Ungültig',
missing => 'Fehlend:',
format => '%s',
},
});
$self->param('Grafik' => $self->cfg('Grafik'));
#$self->authen->config(
# DRIVER => [ 'Generic', { user1 => '123' } ],
#);
#$self->authen->protected_runmodes('protected');
##$self->authen->protected_runmodes(':all');
} # /cgiapp_init
sub do_stuff {
my $self = shift;
my $url = $self->param('CMS') . '/MyApp/protected';
my $ausg = qq~
Linmk zu geschütztem Bereich
~;
return $ausg;
} # /do_stuff
sub geschuetzt {
my $self = shift;
my $ausg = qq~
Willkommen im speziell geschützten Bereich.
~;
return $ausg;
} # /geschuetzt
sub cgiapp_postrun {
my $self = shift;
my $output_ref = shift;
# Sete den Rahmen um den Inhalt, der in den verschiedenen Runmodes erstellt wurde.
my $t = $self->load_tmpl('_hauptTemplate.tmpl', associate => $self);
$t->param('Seiteninhalt' => $$output_ref);
$$output_ref = $t->output();
$self->htmltidy_clean($output_ref);
} # /cgiapp_postrun
1;