package Ernad::Index; use base 'CGI::Application'; use strict; use warnings; use Carp qw(confess); use FCGI; use Ernad::Main; use Ernad::Web::Error; sub setup { my $self = shift; $self->start_mode('mode1'); $self->run_modes('mode1' => 'show'); } ## shows profile sub show { my $self=shift; $self->header_add(-type => 'text/html', -charset => 'utf-8', # -'Cache-Control' => 'no-cache, no-store, must-revalidate' ); my $q=$self->query(); my $e=$main::e; my $params=$q->Vars(); my $out=eval { Ernad::Main::handle_query($params,$e); }; ## show error if($@) { #$self->header_add(-type => 'text/plain', # -charset => 'utf-8'); my $error=$@; my $we=Ernad::Web::Error->new(); my $string=$we->save($error); return $string; } return $out; } 1;