[BACK]Return to dudelicious.pl CVS log [TXT][DIR] Up to [local] / todotxt / Text-Todo / bin

File: [local] / todotxt / Text-Todo / bin / dudelicious.pl (download)

Revision 1.2, Mon Apr 26 20:27:57 2010 UTC (14 years, 2 months ago) by andrew
Branch: MAIN
Changes since 1.1: +4 -0 lines

Make it a package so it can be tested.  Not quite sure how to do that yet, but it should come.

#!/usr/bin/env perl

package Dudelicious;

BEGIN { use FindBin; use lib "$FindBin::Bin/mojo/lib" }

use Mojolicious::Lite;

get '/' => 'index';

get '/:groovy' => sub {
    my $self = shift;
    $self->render_text($self->param('groovy'), layout => 'funky');
};

app->start;
__DATA__

@@ index.html.ep
% layout 'funky';
Yea baby!

@@ layouts/funky.html.ep
<!doctype html><html>
    <head><title>Funky!</title></head>
    <body><%== content %></body>
</html>