@@ -1,5 +1,13 @@
Go to http://github.com/plack/Plack/issues for the roadmap and known issues.
+1.0034 2015-02-02 21:42:42 CET
+ [SECURITY]
+ - Fixed a possible directory traversal with Plack::App::File on Win32 (sri)
+
+ [IMPROVEMENTS]
+ - Documentation improvements (timbunce, oalders, autarch, frioux)
+ - Avoid warnings in Plack::App::WrapCGI (frioux)
+
1.0033 2014-10-23 12:33:18 PDT
[BUG FIXES]
- Lint: Fix error messages (fgabolde) #473
@@ -76,7 +84,7 @@ Go to http://github.com/plack/Plack/issues for the roadmap and known issues.
1.0025 2013-06-12 13:08:58 PDT
[INCOMPATIBLE CHANGES]
- No XS! Eliminates dependency to LWP::UserAgent by making it completely optional for
- testing. If you run Plack::Test with Server implemenetation or run Plack::Test::Suite
+ testing. If you run Plack::Test with Server implementation or run Plack::Test::Suite
(for PSGI handlers) without LWP installed, the tests will automatically be skipped.
This removes the eventual sub-dependency to HTML::Parser, which is the only XS dependency
in Plack. #408
@@ -1,4 +1,4 @@
-# This file was automatically generated by Dist::Zilla::Plugin::Manifest v5.021.
+# This file was automatically generated by Dist::Zilla::Plugin::Manifest v5.031.
Changes
LICENSE
MANIFEST
@@ -4,13 +4,13 @@
"Tatsuhiko Miyagawa"
],
"dynamic_config" : 0,
- "generated_by" : "Dist::Milla version v1.0.8, Dist::Zilla version 5.021, CPAN::Meta::Converter version 2.142690",
+ "generated_by" : "Dist::Zilla version 5.031, Dist::Milla version v1.0.14, CPAN::Meta::Converter version 2.143240",
"license" : [
"perl_5"
],
"meta-spec" : {
"url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
- "version" : "2"
+ "version" : 2
},
"name" : "Plack",
"no_index" : {
@@ -32,7 +32,7 @@
},
"develop" : {
"requires" : {
- "Dist::Milla" : "v1.0.8",
+ "Dist::Milla" : "v1.0.14",
"Test::Pod" : "1.41"
}
},
@@ -96,12 +96,13 @@
"web" : "https://github.com/plack/Plack"
}
},
- "version" : "1.0033",
+ "version" : "1.0034",
"x_authority" : "cpan:MIYAGAWA",
"x_contributors" : [
"Aaron Trevena <aaron.trevena@gmail.com>",
- "Alex J. G. Burzyński <ajgb@cpan.org>",
+ "Ævar Arnfjörð Bjarmason <avarab@gmail.com>",
"Alexandr Ciornii <alexchorny@gmail.com>",
+ "Alex J. G. Burzyński <ajgb@cpan.org>",
"Andrew Rodland <andrew@cleverdomain.org>",
"Andy Wardley <abw@wardley.org>",
"Aristotle Pagaltzis <pagaltzis@gmx.de>",
@@ -111,8 +112,11 @@
"Ben Morrow <ben@morrow.me.uk>",
"Bernhard Graf <augensalat@gmail.com>",
"Chad Granum <chad.granum@dreamhost.com>",
+ "chansen <chansen@cpan.org>",
"Chia-liang Kao <clkao@clkao.org>",
+ "cho45 <cho45@lowreal.net>",
"Christian Walde <walde.christian@googlemail.com>",
+ "chromatic <chromatic@wgz.org>",
"Cosimo Streppone <cosimo@cpan.org>",
"Daisuke Maki <lestrrat+github@gmail.com>",
"Daisuke Murase <typester@cpan.org>",
@@ -123,13 +127,17 @@
"Eduardo Arino de la Rubia <earino@rent.com>",
"Eric Johnson <eric.git@iijo.org>",
"Fabrice Gabolde <fabrice.gabolde@gmail.com>",
+ "fayland <fayland@gmail.com>",
"Florian Ragwitz <rafl@debian.org>",
+ "franck cuny <franck@lumberjaph.net>",
+ "fREW Schmidt <frioux@gmail.com>",
"Graham Knop <haarg@haarg.org>",
"Grant McLean <grant@catalyst.net.nz>",
- "HIROSE Masaaki <hirose31@gmail.com>",
"Hans Dieter Pearcey <hdp@weftsoar.net>",
"Haruka Iwao <haruka@fout.jp>",
"Henry Baragar <Henry.Baragar@Instantiated.Ca>",
+ "hiratara <hiratara@cpan.org>",
+ "HIROSE Masaaki <hirose31@gmail.com>",
"Hiroshi Sakai <ziguzagu@gmail.com>",
"Jakob Voss <jakob@nichtich.de>",
"Jakob Voss <voss@gbv.de>",
@@ -141,12 +149,15 @@
"John Napiorkowski <jjnapiork@cpan.org>",
"Jonathan Swartz <swartz@pobox.com>",
"Justin Davis <jrcd83@gmail.com>",
+ "kakuno <kakuno@livedoor.jp>",
"Kang-min Liu <gugod@gugod.org>",
"Karen Etheridge <ether@cpan.org>",
"Kazuho Oku <kazuhooku@gmail.com>",
"Keedi Kim <keedi.k@gmail.com>",
"Lee Aylward <lee@laylward.com>",
+ "leedo <lee@laylward.com>",
"Leo Lapworth <leo@cuckoo.org>",
+ "mala <github@ma.la>",
"Marian Schubert <maio@netsafe.cz>",
"Mark Fowler <mark@twoshortplanks.com>",
"Mark Stosberg <mark@stosberg.com>",
@@ -159,12 +170,14 @@
"Oliver Gorwits <oliver@cpan.org>",
"Oliver Paukstadt <pstadt@sourcentral.org>",
"Olivier Mengué <dolmen@cpan.org>",
+ "osfameron <hakim.cassimally@gmail.com>",
"Panu Ervamaa <panu.ervamaa@frantic.com>",
"Paul Driver <frodwith@gmail.com>",
"Pedro Melo <melo@simplicidade.org>",
"Peter Flanigan <github@roxsoft.co.uk>",
"Peter Makholm <peter@makholm.net>",
"Piotr Roszatycki <piotr.roszatycki@gmail.com>",
+ "punytan <punytan@gmail.com>",
"Rafael Kitover <rkitover@cpan.org>",
"Randy Stauner <rwstauner@cpan.org>",
"Ray Miller <rm7@sanger.ac.uk>",
@@ -178,29 +191,18 @@
"Stevan Little <stevan.little@iinteractive.com>",
"Stuart A Johnston <saj_git@thecommune.net>",
"Takeshi OKURA <okura3@gmail.com>",
+ "Tatsuhiko Miyagawa <miyagawa@bulknews.net>",
+ "Tim Bunce <Tim.Bunce@pobox.com>",
"Tokuhiro Matsuno <tokuhirom@gmail.com>",
- "Tom Heady <tom-github.com@punch.net>",
"Tomas Doran <bobtfish@bobtfish.net>",
+ "Tom Heady <tom-github.com@punch.net>",
+ "vti <viacheslav.t@gmail.com>",
"Wallace Reis <wreis@123people.com>",
+ "xaicron <xaicron@gmail.com>",
"Yann Kerherve <yann@cyberion.net>",
+ "yappo <yappo@shibuya.pl>",
"Yury Zavarin <yury.zavarin@gmail.com>",
"Yuval Kogman <nothingmuch@woobling.org>",
- "chansen <chansen@cpan.org>",
- "cho45 <cho45@lowreal.net>",
- "chromatic <chromatic@wgz.org>",
- "fREW Schmidt <frioux@gmail.com>",
- "fayland <fayland@gmail.com>",
- "franck cuny <franck@lumberjaph.net>",
- "hiratara <hiratara@cpan.org>",
- "kakuno <kakuno@livedoor.jp>",
- "leedo <lee@laylward.com>",
- "mala <github@ma.la>",
- "osfameron <hakim.cassimally@gmail.com>",
- "punytan <punytan@gmail.com>",
- "vti <viacheslav.t@gmail.com>",
- "xaicron <xaicron@gmail.com>",
- "yappo <yappo@shibuya.pl>",
- "Ævar Arnfjörð Bjarmason <avarab@gmail.com>",
"唐鳳 <audreyt@audreyt.org>"
]
}
@@ -9,7 +9,7 @@ configure_requires:
ExtUtils::MakeMaker: '0'
File::ShareDir::Install: '0.06'
dynamic_config: 0
-generated_by: 'Dist::Milla version v1.0.8, Dist::Zilla version 5.021, CPAN::Meta::Converter version 2.142690'
+generated_by: 'Dist::Zilla version 5.031, Dist::Milla version v1.0.14, CPAN::Meta::Converter version 2.143240'
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -44,12 +44,13 @@ resources:
bugtracker: https://github.com/plack/Plack/issues
homepage: https://github.com/plack/Plack
repository: https://github.com/plack/Plack.git
-version: '1.0033'
+version: '1.0034'
x_authority: cpan:MIYAGAWA
x_contributors:
- 'Aaron Trevena <aaron.trevena@gmail.com>'
- - 'Alex J. G. Burzyński <ajgb@cpan.org>'
+ - 'Ævar Arnfjörð Bjarmason <avarab@gmail.com>'
- 'Alexandr Ciornii <alexchorny@gmail.com>'
+ - 'Alex J. G. Burzyński <ajgb@cpan.org>'
- 'Andrew Rodland <andrew@cleverdomain.org>'
- 'Andy Wardley <abw@wardley.org>'
- 'Aristotle Pagaltzis <pagaltzis@gmx.de>'
@@ -59,8 +60,11 @@ x_contributors:
- 'Ben Morrow <ben@morrow.me.uk>'
- 'Bernhard Graf <augensalat@gmail.com>'
- 'Chad Granum <chad.granum@dreamhost.com>'
+ - 'chansen <chansen@cpan.org>'
- 'Chia-liang Kao <clkao@clkao.org>'
+ - 'cho45 <cho45@lowreal.net>'
- 'Christian Walde <walde.christian@googlemail.com>'
+ - 'chromatic <chromatic@wgz.org>'
- 'Cosimo Streppone <cosimo@cpan.org>'
- 'Daisuke Maki <lestrrat+github@gmail.com>'
- 'Daisuke Murase <typester@cpan.org>'
@@ -71,13 +75,17 @@ x_contributors:
- 'Eduardo Arino de la Rubia <earino@rent.com>'
- 'Eric Johnson <eric.git@iijo.org>'
- 'Fabrice Gabolde <fabrice.gabolde@gmail.com>'
+ - 'fayland <fayland@gmail.com>'
- 'Florian Ragwitz <rafl@debian.org>'
+ - 'franck cuny <franck@lumberjaph.net>'
+ - 'fREW Schmidt <frioux@gmail.com>'
- 'Graham Knop <haarg@haarg.org>'
- 'Grant McLean <grant@catalyst.net.nz>'
- - 'HIROSE Masaaki <hirose31@gmail.com>'
- 'Hans Dieter Pearcey <hdp@weftsoar.net>'
- 'Haruka Iwao <haruka@fout.jp>'
- 'Henry Baragar <Henry.Baragar@Instantiated.Ca>'
+ - 'hiratara <hiratara@cpan.org>'
+ - 'HIROSE Masaaki <hirose31@gmail.com>'
- 'Hiroshi Sakai <ziguzagu@gmail.com>'
- 'Jakob Voss <jakob@nichtich.de>'
- 'Jakob Voss <voss@gbv.de>'
@@ -89,12 +97,15 @@ x_contributors:
- 'John Napiorkowski <jjnapiork@cpan.org>'
- 'Jonathan Swartz <swartz@pobox.com>'
- 'Justin Davis <jrcd83@gmail.com>'
+ - 'kakuno <kakuno@livedoor.jp>'
- 'Kang-min Liu <gugod@gugod.org>'
- 'Karen Etheridge <ether@cpan.org>'
- 'Kazuho Oku <kazuhooku@gmail.com>'
- 'Keedi Kim <keedi.k@gmail.com>'
- 'Lee Aylward <lee@laylward.com>'
+ - 'leedo <lee@laylward.com>'
- 'Leo Lapworth <leo@cuckoo.org>'
+ - 'mala <github@ma.la>'
- 'Marian Schubert <maio@netsafe.cz>'
- 'Mark Fowler <mark@twoshortplanks.com>'
- 'Mark Stosberg <mark@stosberg.com>'
@@ -107,12 +118,14 @@ x_contributors:
- 'Oliver Gorwits <oliver@cpan.org>'
- 'Oliver Paukstadt <pstadt@sourcentral.org>'
- 'Olivier Mengué <dolmen@cpan.org>'
+ - 'osfameron <hakim.cassimally@gmail.com>'
- 'Panu Ervamaa <panu.ervamaa@frantic.com>'
- 'Paul Driver <frodwith@gmail.com>'
- 'Pedro Melo <melo@simplicidade.org>'
- 'Peter Flanigan <github@roxsoft.co.uk>'
- 'Peter Makholm <peter@makholm.net>'
- 'Piotr Roszatycki <piotr.roszatycki@gmail.com>'
+ - 'punytan <punytan@gmail.com>'
- 'Rafael Kitover <rkitover@cpan.org>'
- 'Randy Stauner <rwstauner@cpan.org>'
- 'Ray Miller <rm7@sanger.ac.uk>'
@@ -126,27 +139,16 @@ x_contributors:
- 'Stevan Little <stevan.little@iinteractive.com>'
- 'Stuart A Johnston <saj_git@thecommune.net>'
- 'Takeshi OKURA <okura3@gmail.com>'
+ - 'Tatsuhiko Miyagawa <miyagawa@bulknews.net>'
+ - 'Tim Bunce <Tim.Bunce@pobox.com>'
- 'Tokuhiro Matsuno <tokuhirom@gmail.com>'
- - 'Tom Heady <tom-github.com@punch.net>'
- 'Tomas Doran <bobtfish@bobtfish.net>'
+ - 'Tom Heady <tom-github.com@punch.net>'
+ - 'vti <viacheslav.t@gmail.com>'
- 'Wallace Reis <wreis@123people.com>'
+ - 'xaicron <xaicron@gmail.com>'
- 'Yann Kerherve <yann@cyberion.net>'
+ - 'yappo <yappo@shibuya.pl>'
- 'Yury Zavarin <yury.zavarin@gmail.com>'
- 'Yuval Kogman <nothingmuch@woobling.org>'
- - 'chansen <chansen@cpan.org>'
- - 'cho45 <cho45@lowreal.net>'
- - 'chromatic <chromatic@wgz.org>'
- - 'fREW Schmidt <frioux@gmail.com>'
- - 'fayland <fayland@gmail.com>'
- - 'franck cuny <franck@lumberjaph.net>'
- - 'hiratara <hiratara@cpan.org>'
- - 'kakuno <kakuno@livedoor.jp>'
- - 'leedo <lee@laylward.com>'
- - 'mala <github@ma.la>'
- - 'osfameron <hakim.cassimally@gmail.com>'
- - 'punytan <punytan@gmail.com>'
- - 'vti <viacheslav.t@gmail.com>'
- - 'xaicron <xaicron@gmail.com>'
- - 'yappo <yappo@shibuya.pl>'
- - 'Ævar Arnfjörð Bjarmason <avarab@gmail.com>'
- '唐鳳 <audreyt@audreyt.org>'
@@ -1,5 +1,5 @@
-# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v5.021.
+# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v5.031.
use strict;
use warnings;
@@ -48,7 +48,7 @@ my %WriteMakefileArgs = (
"Test::More" => "0.88",
"Test::Requires" => 0
},
- "VERSION" => "1.0033",
+ "VERSION" => "1.0034",
"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/recursive/*.t t/Plack-Middleware/stacktrace/*.t t/Plack-Request/*.t t/Plack-Response/*.t t/Plack-Runner/*.t t/Plack-TempBuffer/*.t t/Plack-Test/*.t t/Plack-Util/*.t"
}
@@ -1,39 +1,48 @@
NAME
- Plack - Perl Superglue for Web frameworks and Web Servers (PSGI toolkit)
+
+ Plack - Perl Superglue for Web frameworks and Web Servers (PSGI
+ toolkit)
DESCRIPTION
- Plack is a set of tools for using the PSGI stack. It contains middleware
- components, a reference server and utilities for Web application
- frameworks. Plack is like Ruby's Rack or Python's Paste for WSGI.
+
+ Plack is a set of tools for using the PSGI stack. It contains
+ middleware components, a reference server and utilities for Web
+ application frameworks. Plack is like Ruby's Rack or Python's Paste for
+ WSGI.
See PSGI for the PSGI specification and PSGI::FAQ to know what PSGI and
Plack are and why we need them.
MODULES AND UTILITIES
- Plack::Handler
+
+ Plack::Handler
+
Plack::Handler and its subclasses contains adapters for web servers. We
- have adapters for the built-in standalone web server HTTP::Server::PSGI,
- CGI, FCGI, Apache1, Apache2 and HTTP::Server::Simple included in the
- core Plack distribution.
+ have adapters for the built-in standalone web server
+ HTTP::Server::PSGI, CGI, FCGI, Apache1, Apache2 and
+ HTTP::Server::Simple included in the core Plack distribution.
There are also many HTTP server implementations on CPAN that have Plack
handlers.
See Plack::Handler when writing your own adapters.
- Plack::Loader
+ Plack::Loader
+
Plack::Loader is a loader to load one Plack::Handler adapter and run a
PSGI application code reference with it.
- Plack::Util
+ Plack::Util
+
Plack::Util contains a lot of utility functions for server implementors
as well as middleware authors.
- .psgi files
+ .psgi files
+
A PSGI application is a code reference but it's not easy to pass code
reference via the command line or configuration files, so Plack uses a
- convention that you need a file named "app.psgi" or similar, which would
- be loaded (via perl's core function "do") to return the PSGI application
+ convention that you need a file named app.psgi or similar, which would
+ be loaded (via perl's core function do) to return the PSGI application
code reference.
# Hello.psgi
@@ -44,75 +53,83 @@ MODULES AND UTILITIES
};
If you use a web framework, chances are that they provide a helper
- utility to automatically generate these ".psgi" files for you, such as:
+ utility to automatically generate these .psgi files for you, such as:
# MyApp.psgi
use MyApp;
my $app = sub { MyApp->run_psgi(@_) };
- It's important that the return value of ".psgi" file is the code
- reference. See "eg/dot-psgi" directory for more examples of ".psgi"
- files.
+ It's important that the return value of .psgi file is the code
+ reference. See eg/dot-psgi directory for more examples of .psgi files.
+
+ plackup, Plack::Runner
- plackup, Plack::Runner
- plackup is a command line launcher to run PSGI applications from command
- line using Plack::Loader to load PSGI backends. It can be used to run
- standalone servers and FastCGI daemon processes. Other server backends
- like Apache2 needs a separate configuration but ".psgi" application file
- can still be the same.
+ plackup is a command line launcher to run PSGI applications from
+ command line using Plack::Loader to load PSGI backends. It can be used
+ to run standalone servers and FastCGI daemon processes. Other server
+ backends like Apache2 needs a separate configuration but .psgi
+ application file can still be the same.
If you want to write your own frontend that replaces, or adds
functionalities to plackup, take a look at the Plack::Runner module.
- Plack::Middleware
+ Plack::Middleware
+
PSGI middleware is a PSGI application that wraps an existing PSGI
application and plays both side of application and servers. From the
servers the wrapped code reference still looks like and behaves exactly
the same as PSGI applications.
- Plack::Middleware gives you an easy way to wrap PSGI applications with a
- clean API, and compatibility with Plack::Builder DSL.
+ Plack::Middleware gives you an easy way to wrap PSGI applications with
+ a clean API, and compatibility with Plack::Builder DSL.
- Plack::Builder
- Plack::Builder gives you a DSL that you can enable Middleware in ".psgi"
+ Plack::Builder
+
+ Plack::Builder gives you a DSL that you can enable Middleware in .psgi
files to wrap existent PSGI applications.
- Plack::Request, Plack::Response
- Plack::Request gives you a nice wrapper API around PSGI $env hash to get
- headers, cookies and query parameters much like Apache::Request in
+ Plack::Request, Plack::Response
+
+ Plack::Request gives you a nice wrapper API around PSGI $env hash to
+ get headers, cookies and query parameters much like Apache::Request in
mod_perl.
- Plack::Response does the same to construct the response array reference.
+ Plack::Response does the same to construct the response array
+ reference.
+
+ Plack::Test
- Plack::Test
Plack::Test is a unified interface to test your PSGI application using
standard HTTP::Request and HTTP::Response pair with simple callbacks.
- Plack::Test::Suite
+ Plack::Test::Suite
+
Plack::Test::Suite is a test suite to test a new PSGI server backend.
CONTRIBUTING
- Patches and Bug Fixes
+
+ Patches and Bug Fixes
+
Small patches and bug fixes can be either submitted via nopaste on IRC
- <irc://irc.perl.org/#plack> or the github issue tracker
- <http://github.com/plack/Plack/issues>. Forking on github
- <http://github.com/plack/Plack> is another good way if you intend to
- make larger fixes.
+ irc://irc.perl.org/#plack or the github issue tracker
+ <http://github.com/plack/Plack/issues>. Forking on github is another
+ good way if you intend to make larger fixes.
- See also <http://contributing.appspot.com/plack> when you think this
+ See also http://contributing.appspot.com/plack when you think this
document is terribly outdated.
- Module Namespaces
- Modules added to the Plack:: sub-namespaces should be reasonably generic
- components which are useful as building blocks and not just simply using
- Plack.
+ Module Namespaces
+
+ Modules added to the Plack:: sub-namespaces should be reasonably
+ generic components which are useful as building blocks and not just
+ simply using Plack.
- Middleware authors are free to use the Plack::Middleware:: namespace for
- their middleware components. Middleware must be written in the pipeline
- style such that they can chained together with other middleware
- components. The Plack::Middleware:: modules in the core distribution are
- good examples of such modules. It is recommended that you inherit from
- Plack::Middleware for these types of modules.
+ Middleware authors are free to use the Plack::Middleware:: namespace
+ for their middleware components. Middleware must be written in the
+ pipeline style such that they can chained together with other
+ middleware components. The Plack::Middleware:: modules in the core
+ distribution are good examples of such modules. It is recommended that
+ you inherit from Plack::Middleware for these types of modules.
Not all middleware components are wrappers, but instead are more like
endpoints in a middleware chain. These types of components should use
@@ -127,15 +144,19 @@ CONTRIBUTING
confuse people badly.
AUTHOR
+
Tatsuhiko Miyagawa
COPYRIGHT
- The following copyright notice applies to all the files provided in this
- distribution, including binary files, unless explicitly noted otherwise.
+
+ The following copyright notice applies to all the files provided in
+ this distribution, including binary files, unless explicitly noted
+ otherwise.
Copyright 2009-2013 Tatsuhiko Miyagawa
CORE DEVELOPERS
+
Tatsuhiko Miyagawa (miyagawa)
Tokuhiro Matsuno (tokuhirom)
@@ -147,6 +168,7 @@ CORE DEVELOPERS
Graham Knop (haarg)
CONTRIBUTORS
+
Yuval Kogman (nothingmuch)
Kazuhiro Osawa (Yappo)
@@ -178,15 +200,17 @@ CONTRIBUTORS
Aaron Trevena
SEE ALSO
+
The PSGI specification upon which Plack is based.
- <http://plackperl.org/>
+ http://plackperl.org/
- The Plack wiki: <https://github.com/plack/Plack/wiki>
+ The Plack wiki: https://github.com/plack/Plack/wiki
- The Plack FAQ: <https://github.com/plack/Plack/wiki/Faq>
+ The Plack FAQ: https://github.com/plack/Plack/wiki/Faq
LICENSE
+
This library is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
@@ -51,7 +51,7 @@ sub locate_file {
@path = ('.');
}
- if (grep $_ eq '..', @path) {
+ if (grep /^\.{2,}$/, @path) {
return $self->return_403;
}
@@ -9,6 +9,13 @@ use CGI::Compile;
use Carp;
use POSIX ":sys_wait_h";
+sub slurp_fh {
+ my $fh = $_[0];
+ local $/;
+ my $v = <$fh>;
+ defined $v ? $v : '';
+}
+
sub prepare_app {
my $self = shift;
my $script = $self->script
@@ -53,19 +60,15 @@ sub prepare_app {
close $stdoutw;
close $stdinr;
- syswrite($stdinw, do {
- local $/;
- my $fh = $env->{'psgi.input'};
- <$fh>;
- });
+ syswrite($stdinw, slurp_fh($env->{'psgi.input'}));
# close STDIN so child will stop waiting
close $stdinw;
my $res = '';
while (waitpid($pid, WNOHANG) <= 0) {
- $res .= do { local $/; <$stdoutr> } || '';
+ $res .= slurp_fh($stdoutr);
}
- $res .= do { local $/; <$stdoutr> } || '';
+ $res .= slurp_fh($stdoutr);
if (POSIX::WIFEXITED($?)) {
return CGI::Parse::PSGI::parse_cgi_output(\$res);
@@ -130,9 +130,15 @@ Plack::Middleware::StackTrace - Displays stack trace when your app dies
=head1 DESCRIPTION
-This middleware catches exceptions (run-time errors) happening in your
-application and displays nice stack trace screen. The stack trace is
-also stored in the environment as a plaintext and HTML under the key
+This middleware uses C<$SIG{__DIE__}> to intercept I<all> exceptions
+(run-time errors) happening in your application, even those that are caught.
+For each exception it builds a detailed stack trace.
+
+If the applications aborts by throwing an exception it will be caught and matched
+against the saved stack traces. If a match is found it will be displayed as a nice
+stack trace screen, if not then the exception will be reported without a stack trace.
+
+The stack trace is also stored in the environment as a plaintext and HTML under the key
C<plack.stacktrace.text> and C<plack.stacktrace.html> respectively, so
that middleware further up the stack can reference it.
@@ -147,6 +153,19 @@ crashing the web server.
Catching errors in streaming response is not supported.
+=head2 Stack Trace Module
+
+The L<Devel::StackTrace::WithLexicals> module will be used to capture the stack trace
+if the installed version is 0.08 or later. Otherwise L<Devel::StackTrace> is used.
+
+=head2 Performance
+
+Gathering the information for a stack trace via L<Devel::StackTrace> is slow,
+and L<Devel::StackTrace::WithLexicals> is significantly slower still.
+This is not usually a concern in development and when exceptions are rare.
+However, your application may include code that's throwing and catching exceptions
+that you're not aware of. Such code will run I<significantly> slower with this module.
+
=head1 CONFIGURATION
=over 4
@@ -100,11 +100,16 @@ is pointless, so you're recommended to use the C<response_cb> wrapper
function in L<Plack::Util> when implementing a post processing
middleware.
- my $res = $app->($env);
- Plack::Util::response_cb($res, sub {
- my $res = shift;
- # do something with $res;
- });
+ sub call {
+ my($self, $env) = @_;
+ # pre-processing $env
+ my $res = $app->($env);
+
+ return Plack::Util::response_cb($res, sub {
+ my $res = shift;
+ # do something with $res;
+ });
+ }
The callback function gets a response as an array reference, and you can
update the reference to implement the post-processing. In the normal
@@ -119,7 +124,7 @@ described below.
sub call {
my($self, $env) = @_;
my $res = $self->app->($env);
- Plack::Util::response_cb($res, sub {
+ return Plack::Util::response_cb($res, sub {
my $res = shift;
$res->[0] = 500;
return;
@@ -2,7 +2,7 @@ package Plack::Request;
use strict;
use warnings;
use 5.008_001;
-our $VERSION = '1.0033';
+our $VERSION = '1.0034';
use HTTP::Headers;
use Carp ();
@@ -325,7 +325,7 @@ Plack::Request - Portable HTTP request object from PSGI env hash
my $req = Plack::Request->new($env);
my $path_info = $req->path_info;
- my $query = $req->param('query');
+ my $query = $req->parameters->{query};
my $res = $req->new_response(200); # new Plack::Response
$res->finalize;
@@ -457,7 +457,7 @@ strings that are sent by clients and are URI decoded.
If there are multiple cookies with the same name in the request, this
method will ignore the duplicates and return only the first value. If
that causes issues for you, you may have to use modules like
-CGI::Simple::Cookie to parse C<<$request->header('Cookies')>> by
+CGI::Simple::Cookie to parse C<< $request->header('Cookies') >> by
yourself.
=item query_parameters
@@ -538,8 +538,15 @@ Shortcut to $req->headers->user_agent.
Returns GET and POST parameters with a CGI.pm-compatible param
method. This is an alternative method for accessing parameters in
-$req->parameters. Unlike CGI.pm, it does I<not> allow
-setting or modifying query parameters.
+$req->parameters just in case you want the compatibility with
+CGI.pm objects.
+
+You are B<not recommended> to use this method since it is easy to
+misuse in a list context such as inside a hash constructor or method
+arguments. Use C<parameters> and Hash::MultiValue instead.
+
+Unlike CGI.pm, it does I<not> allow setting or modifying query
+parameters.
$value = $req->param( 'foo' );
@values = $req->param( 'foo' );
@@ -1,7 +1,7 @@
package Plack::Response;
use strict;
use warnings;
-our $VERSION = '1.0033';
+our $VERSION = '1.0034';
use Plack::Util::Accessor qw(body status);
use Carp ();
@@ -3,7 +3,7 @@ package Plack;
use strict;
use warnings;
use 5.008_001;
-our $VERSION = '1.0033';
+our $VERSION = '1.0034';
1;
__END__
@@ -10,7 +10,7 @@ __END__
=head1 NAME
-plackup - Run PSGI application with Plack servers
+plackup - Run PSGI application with Plack handlers
=head1 SYNOPSIS