##
use Plack::Builder;
use Plack::App::File;
my $css = Plack::App::File->new(root => "/var/www/css");
my $js = Plack::App::File->new(root => "/var/www/js");
my $images = Plack::App::File->new(root => "/var/www/images");
my $ico = Plack::App::File->new(root => "/var/www");
my $action = sub {
($sec,$min,$hour,$mday,$mon,
$year,$wday,$yday,$isdst) = localtime(time);
return [200, [ 'Content-Type' => 'text/html' ],
[ "
Plack Clock
the time is $hour:$min:$sec
"
]
];
};
my $app = builder {
mount "/images" => $images;
mount "/css" => $css;
mount "/js" => $js;
mount "/favicon.ico" => $ico;
mount "/" => builder {
enable 'ContentLength';
$action;
}
};
####
mount "/" => builder {
enable 'ContentLength';
enable 'Debug', panels => [ qw(Memory Timer) ];
enable 'Session' store => 'File';
$action;
}
####
don't do this; wrong
--------------------
mount "/" => builder {
enable 'Debug', panels => [ qw(Memory Timer) ];
enable 'ContentLength';
enable 'Session' store => 'File';
$action;
}