Plack
view release on metacpan or search on metacpan
- Fixed a test (psgibin.t) failure in case sensitive filesystem
- Fixed a warning in Plack::Util::header_set
0.9019 Sun Dec 6 05:56:30 GMT 2009
- Fixed a bug in Plack::Util::header_set when to clear multiple headers (chiba)
- Added Plack::App::CGIBin that runs cgi-bin scripts as a PSGI application
- Added Plack::App::PSGIBin that loads .psgi files from local filesystem
0.9018 Thu Dec 3 00:48:04 PST 2009
- Allow Plack::Middleware->new to accept plain hashes
- Added Plack::App::Cascade to create a compound apps that cascade requests
- Added POE backend to benchmarks/ab.pl
- Implemented Plack::Server::Apache[12]->preload to preload apps in <Perl> or startup file
0.9017 Sun Nov 29 17:33:36 JST 2009
- Fixed more tests that fail on Win32 (charsbar)
0.9016 Sun Nov 29 16:39:40 JST 2009
- removed Middleware::Deflater from the dist.
- Fixed Standalone so as not to use Time::HiRes::Alarm on Win32 systems (charsbar, kazuho)
- Fixed App::File to set file path using forward slashes on Win32 (charsbar) #49
t/Plack-MIME/add_type.t
t/Plack-MIME/basic.t
t/Plack-MIME/fallback.t
t/Plack-Middleware/access_log.t
t/Plack-Middleware/access_log_timed.t
t/Plack-Middleware/access_log_value_zero.t
t/Plack-Middleware/auth_basic.t
t/Plack-Middleware/auth_basic_env.t
t/Plack-Middleware/auth_basic_simple.t
t/Plack-Middleware/bufferedstreaming.t
t/Plack-Middleware/cascade/basic.t
t/Plack-Middleware/cascade/streaming.t
t/Plack-Middleware/cgi-bin/cgi_dir.cgi
t/Plack-Middleware/cgi-bin/hello.cgi
t/Plack-Middleware/cgi-bin/hello.sh
t/Plack-Middleware/cgi-bin/hello2.cgi
t/Plack-Middleware/cgi-bin/hello3.cgi
t/Plack-Middleware/cgi-bin/utf8.cgi
t/Plack-Middleware/cgibin.t
t/Plack-Middleware/cgibin_exec.t
t/Plack-Middleware/chunked.t
t/Plack-Middleware/component-leak.t
Makefile.PL view on Meta::CPAN
"URI" => "1.59",
"WWW::Form::UrlEncoded" => "0.23",
"parent" => 0
},
"TEST_REQUIRES" => {
"Test::More" => "0.88",
"Test::Requires" => 0
},
"VERSION" => "1.0051",
"test" => {
"TESTS" => "t/*.t t/HTTP-Message-PSGI/*.t t/HTTP-Server-PSGI/*.t t/Plack-Builder/*.t t/Plack-HTTPParser-PP/*.t t/Plack-Handler/*.t t/Plack-Loader/*.t t/Plack-MIME/*.t t/Plack-Middleware/*.t t/Plack-Middleware/cascade/*.t t/Plack-Middleware/recurs...
}
);
my %FallbackPrereqs = (
"Apache::LogFormat::Compiler" => "0.33",
"Cookie::Baker" => "0.07",
"Devel::StackTrace" => "1.23",
"Devel::StackTrace::AsHTML" => "0.11",
"File::ShareDir" => "1.00",
lib/Plack/App/Cascade.pm view on Meta::CPAN
Plack::App::Cascade - Cascadable compound application
=head1 SYNOPSIS
use Plack::App::Cascade;
use Plack::App::URLMap;
use Plack::App::File;
# Serve static files from multiple search paths
my $cascade = Plack::App::Cascade->new;
$cascade->add( Plack::App::File->new(root => "/www/example.com/foo")->to_app );
$cascade->add( Plack::App::File->new(root => "/www/example.com/bar")->to_app );
my $app = Plack::App::URLMap->new;
$app->map("/static", $cascade);
$app->to_app;
=head1 DESCRIPTION
Plack::App::Cascade is a Plack middleware component that compounds
several apps and tries them to return the first response that is not
404.
=head1 METHODS
t/Plack-Middleware/cascade/basic.t view on Meta::CPAN
use Plack::Test;
use Test::More;
use Plack::App::Cascade;
use Plack::App::File;
use HTTP::Request::Common;
my $cascade = Plack::App::Cascade->new;
test_psgi $cascade, sub {
my $cb = shift;
$res = $cb->(GET "http://localhost/");
is $res->code, 404;
};
$cascade->add( Plack::App::File->new(root => "t/Plack-Middleware")->to_app );
$cascade->add( Plack::App::File->new(root => "t/Plack-Util")->to_app );
$cascade->add( sub { [ 404, [], [ 'Custom 404 Page' ] ] } );
test_psgi $cascade, sub {
my $cb = shift;
my $res = $cb->(GET "http://localhost/access_log.t");
is $res->code, 200;
$res = $cb->(GET "http://localhost/foo");
is $res->code, 404;
is $res->content, 'Custom 404 Page';
$res = $cb->(GET "http://localhost/foreach.t");
t/Plack-Middleware/cascade/streaming.t view on Meta::CPAN
use Plack::Test;
use Test::More;
use Plack::App::Cascade;
use HTTP::Request::Common;
my $cascade = Plack::App::Cascade->new;
$cascade->add( sub { return sub { my $respond = shift; $respond->([ 404, [], [ "Duh" ] ]) } } );
$cascade->add( sub { return [ 403, [ 'Content-Type', 'text/plain' ], [ "Forbidden" ] ] } );
$cascade->add( sub { my $env = shift;
return sub {
my $r = shift;
if ($env->{PATH_INFO} eq '/') {
my $w = $r->([ 200, [ 'Content-Type', 'text/plain' ] ]);
$w->write("Hello");
$w->close;
} else {
$r->([ 404, [ 'Content-Type', 'text/plain' ], [ 'Custom 404 Page' ] ]);
}
} });
$cascade->catch([ 403, 404 ]);
test_psgi $cascade, sub {
my $cb = shift;
my $res = $cb->(GET "http://localhost/");
is $res->code, 200;
is $res->content, "Hello";
$res = $cb->(GET "http://localhost/xyz");
is $res->code, 404;
is $res->content, 'Custom 404 Page';
};
( run in 0.748 second using v1.01-cache-2.11-cpan-49f99fa48dc )