1 package LolCatalyst::Lite::Controller::Root;
5 use parent 'Catalyst::Controller';
7 __PACKAGE__->config->{namespace} = '';
9 sub index :Path :Args(0) {
10 my ( $self, $c ) = @_;
14 my ( $self, $c ) = @_;
15 $c->detach('/error_404');
18 sub error_404 :Private {
19 my ( $self, $c ) = @_;
20 $c->response->status(404);
21 $c->response->body( 'Page not found' );
24 sub translate :Private {
26 my $lol = $c->req->body_params->{lol}; # only for a POST request
27 # $c->req->params->{lol} would catch GET or POST
28 # $c->req->query_params would catch GET params only
31 result => $c->model('Translator')->translate($lol),
32 template => 'index.tt',
36 sub translate_service : Local {
38 $c->forward('translate');
39 $c->stash->{current_view} = 'Service';
42 sub end : ActionClass('RenderView') {
44 my $errors = scalar @{$c->error};
46 $c->log->error("Errors in ${\$c->action}:");
47 $c->log->error($_) for @{$c->error};
49 $c->res->body('internal server error');