summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Woodward2010-07-15 01:23:09 -0400
committerJason Woodward2010-07-15 01:23:09 -0400
commit164963b04ff6413734feda91d45774ee1d83e62d (patch)
tree0fd3e59502177913b1d455cee3c807be9da921f5
parent8a370030afeef7a36907a6cfb7e4eca608f16eec (diff)
downloadJaos-WebApp-164963b04ff6413734feda91d45774ee1d83e62d.tar.gz
updated synopsys0.3.1
-rw-r--r--lib/Jaos/WebApp.pm17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/Jaos/WebApp.pm b/lib/Jaos/WebApp.pm
index 2e8d9d2..be62cf6 100644
--- a/lib/Jaos/WebApp.pm
+++ b/lib/Jaos/WebApp.pm
@@ -196,6 +196,22 @@ Jaos::WebApp - Minimal web application framework
$app->connect('/login', controller => 'MyApp::Controller', action => 'login', method => 'post');
$app->connect('/', controller => 'MyApp::Controller', action => 'frontpage');
}
+
+ package MyApp::Controller;
+ use base qw/Jaos::WebApp::Controller/;
+
+ sub about { shift->render( tt => 'about.tt'); }
+ sub frontpage { shift->render( tt => 'index.tt'); }
+ sub login {
+ my $self = shift;
+ my $username = $self->param('username');
+ my $password = $self->param('username');
+ if ($username && $password) {
+ $self->render( tt => 'logged_in.tt');
+ } else {
+ $self->render( tt => 'auth_failed.tt');
+ }
+ }
1;
# Later, in your application.psgi file...
@@ -217,6 +233,7 @@ Here are some examples of how to deploy the application with Plack.
<IfModule mod_perl.c>
<Perl>
+ use lib qw|/path/to/lib|;
use Plack::Handler::Apache2;
Plack::Handler::Apache2->preload("/path/to/application.psgi");
</Perl>