This document discusses Mojolicious, a lightweight web framework for Perl. It provides examples of using Mojolicious to quickly generate a new project skeleton, start a web server, and add routing and templates. The document also lists some advantages of Mojolicious like its small core dependencies, quick prototyping capabilities, and ability to scale from simple to more complex applications.
7. catalyst.pl new_project
created "new_project"
created "new_project/script"
created "new_project/lib"
[ snip ]
created "new_project/script/new_project_server.pl"
created "new_project/script/new_project_test.pl"
created "new_project/script/new_project_create.pl"
18. query CouchDB
my $client = Mojo::Client->new;
my $url = $couch_user_url.
"?key="'.$self->session->{'name'}.'"';
my $view =
$client->get($url)->success->json->{rows}->[0]->
{doc};
19. routing
? get ¡®/foo¡¯ => (agent qr/iPhone/) => sub {
? post ¡®/foo¡¯ => sub { #all treated the same }
? any => sub { #catch all }
? ladder sub { return 1;} #authentication