use warnings; use strict; use CGI::Application::Server; use lib 'lib'; use Shop; use CGI::Application::Dispatch; CGI::Application::Dispatch->dispatch(); sub dispatch_args { return { prefix => '', table => [ '' => { app => 'Shop', rm => 'products' }, ':app/:rm' => { }, 'admin/:app/:rm' => { prefix => 'MyApp::Admin' }, ], }; } my $app = Shop->new(PARAMS => { }); my $server = CGI::Application::Server->new(); #$server->document_root('./t/www'); $server->entry_points({ '/index.cgi' => $app, }); $server->run; #### # In "Shop.pm"... package Shop; use base 'Titanium'; sub setup { my $c = shift; $c->start_mode('families'); $c->error_mode('fallo'); $c->run_modes([qw/ families products fallo /]); } sub families { my $c = shift; my $errs = shift; my $plantilla = $c->load_tmpl; $plantilla->param( TITULO_PAGINA => 'titulo', CUERPO_PAGINA => 'cuerpo', ); return $plantilla->output; } sub products { my $c = shift; my $plantilla = $c->load_tmpl; $plantilla->param( TITULO_PAGINA => 'olutit', CUERPO_PAGINA => 'opreuc', ); return $plantilla->output; } sub fallo { my $c = shift; my $plantilla = $c->load_tmpl; $plantilla->param( TITULO_PAGINA => 'FALLO fallo FALLO', CUERPO_PAGINA => 'error ERROR error', ); } 1;