package MyApp;

use strict;
use warnings;
use base qw(CGI::Application);
use CGI::Application::Plugin::DebugScreen;
use CGI::Application::Plugin::TT;

sub setup{
    my $self = shift;
    $self->start_mode('index');
    $self->run_modes(
        'index'=>'dispatch_index',
        'test'=>'dispatch_test'
    );
    $self->mode_param(path_info=>1);
    $self->header_props(-charset=>'utf8');
}

sub dispatch_index{
    my $self = shift;
    #die "foooo";
    #&foo();
    return $self->tt_process('index.tt.html');
}

sub dispatch_test{
    my $self = shift;
    my $test=0;
    #local $SIG{__DIE__}=undef;
    my $var = eval {"10/$test"} || 0;
    return $var;
}

1;





