Hi,
I'm evaluating Titanium for using it as a Web Framework. Titanium is a package including CGI::Application and several plugins.
I'm not able to access to the diferent runtimes. May be the error is in the Dispatch module. I've done a small CGI::Application and routes work there (with format /helloworld.cgi-app2.pl?rm=mode3&calling_mode=2). I'd like to have more beatifull URL like /Application/Runmode/Parameter.
This code is the HTTP server executed using CGI::Application::Server:
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;
This code is the Application:
# 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;
Can you find what i'm missing?
Thank you,
Kelkoon
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.