r69810 - in /trunk/libplack-perl: Changes META.yml debian/changelog lib/Plack.pm lib/Plack/Request.pm lib/Plack/Response.pm lib/Plack/Runner.pm lib/Plack/Server/ServerSimple.pm lib/Plack/Util.pm
jawnsy-guest at users.alioth.debian.org
jawnsy-guest at users.alioth.debian.org
Sun Feb 27 02:20:16 UTC 2011
Author: jawnsy-guest
Date: Sun Feb 27 02:19:56 2011
New Revision: 69810
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=69810
Log:
NOTE: These changes are in 0.9972 as well -- jawnsy
* New upstream release
Modified:
trunk/libplack-perl/Changes
trunk/libplack-perl/META.yml
trunk/libplack-perl/debian/changelog
trunk/libplack-perl/lib/Plack.pm
trunk/libplack-perl/lib/Plack/Request.pm
trunk/libplack-perl/lib/Plack/Response.pm
trunk/libplack-perl/lib/Plack/Runner.pm
trunk/libplack-perl/lib/Plack/Server/ServerSimple.pm
trunk/libplack-perl/lib/Plack/Util.pm
Modified: trunk/libplack-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libplack-perl/Changes?rev=69810&op=diff
==============================================================================
--- trunk/libplack-perl/Changes (original)
+++ trunk/libplack-perl/Changes Sun Feb 27 02:19:56 2011
@@ -2,6 +2,10 @@
Take a look at http://github.com/miyagawa/Plack/issues for the planned changes before 1.0 release.
+0.9972 Thu Feb 24 10:50:01 PST 2011
+ - Fixed the Plack::Runner docs to avoid the cargo cult issue of __FILE__ eq $0
+ - Added a silly check to give warnings if the idiom __FILE__ eq $0 is used in .psgi
+
0.9971 Wed Feb 23 14:02:35 PST 2011
[INCOMPATIBLE CHANGES]
- Localize $0 to the given .psgi path when evaluating it in Plack::Util::load_psgi()
Modified: trunk/libplack-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libplack-perl/META.yml?rev=69810&op=diff
==============================================================================
--- trunk/libplack-perl/META.yml (original)
+++ trunk/libplack-perl/META.yml Sun Feb 27 02:19:56 2011
@@ -40,4 +40,4 @@
homepage: http://plackperl.org
license: http://dev.perl.org/licenses/
repository: git://github.com/miyagawa/Plack.git
-version: 0.9971
+version: 0.9972
Modified: trunk/libplack-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libplack-perl/debian/changelog?rev=69810&op=diff
==============================================================================
--- trunk/libplack-perl/debian/changelog (original)
+++ trunk/libplack-perl/debian/changelog Sun Feb 27 02:19:56 2011
@@ -1,13 +1,19 @@
-libplack-perl (0.9971-1) UNRELEASED; urgency=low
+libplack-perl (0.9972-1) UNRELEASED; urgency=low
+ [ Maximilian Gass ]
Plack 0.9971 breaks compatibility, a change that might be reverted. I am
waiting for a decision/response by upstream.
+
+ NOTE: These changes are in 0.9972 as well -- jawnsy
* New upstream release
* Remove fix-pod-spelling.patch, has been applied upstream
* Add myself to Uploaders
- -- Maximilian Gass <mxey at cloudconnected.org> Thu, 24 Feb 2011 13:07:20 +0100
+ [ Jonathan Yu ]
+ * New upstream release
+
+ -- Jonathan Yu <jawnsy at cpan.org> Sat, 26 Feb 2011 13:37:38 -0500
libplack-perl (0.9969-1) unstable; urgency=low
Modified: trunk/libplack-perl/lib/Plack.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libplack-perl/lib/Plack.pm?rev=69810&op=diff
==============================================================================
--- trunk/libplack-perl/lib/Plack.pm (original)
+++ trunk/libplack-perl/lib/Plack.pm Sun Feb 27 02:19:56 2011
@@ -3,7 +3,7 @@
use strict;
use warnings;
use 5.008_001;
-our $VERSION = '0.9971';
+our $VERSION = '0.9972';
$VERSION = eval $VERSION;
1;
Modified: trunk/libplack-perl/lib/Plack/Request.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libplack-perl/lib/Plack/Request.pm?rev=69810&op=diff
==============================================================================
--- trunk/libplack-perl/lib/Plack/Request.pm (original)
+++ trunk/libplack-perl/lib/Plack/Request.pm Sun Feb 27 02:19:56 2011
@@ -2,7 +2,7 @@
use strict;
use warnings;
use 5.008_001;
-our $VERSION = '0.9971';
+our $VERSION = '0.9972';
$VERSION = eval $VERSION;
use HTTP::Headers;
Modified: trunk/libplack-perl/lib/Plack/Response.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libplack-perl/lib/Plack/Response.pm?rev=69810&op=diff
==============================================================================
--- trunk/libplack-perl/lib/Plack/Response.pm (original)
+++ trunk/libplack-perl/lib/Plack/Response.pm Sun Feb 27 02:19:56 2011
@@ -1,7 +1,7 @@
package Plack::Response;
use strict;
use warnings;
-our $VERSION = '0.9971';
+our $VERSION = '0.9972';
$VERSION = eval $VERSION;
use Plack::Util::Accessor qw(body status);
Modified: trunk/libplack-perl/lib/Plack/Runner.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libplack-perl/lib/Plack/Runner.pm?rev=69810&op=diff
==============================================================================
--- trunk/libplack-perl/lib/Plack/Runner.pm (original)
+++ trunk/libplack-perl/lib/Plack/Runner.pm Sun Feb 27 02:19:56 2011
@@ -298,14 +298,21 @@
If you I<really> want to make your C<.psgi> runnable as a standalone
script, you can do this:
- # foo.psgi
- if (__FILE__ eq $0) {
+ my $app = sub { ... };
+
+ unless (caller) {
require Plack::Runner;
- Plack::Runner->run(@ARGV, $0);
+ my $runner = Plack::Runner->new;
+ $runner->parse_options(@ARGV);
+ return $runner->run($app);
}
- # This should always come last
- my $app = sub { ... };
+ return $app;
+
+B<WARNING>: this section used to recommend C<if (__FILE__ eq $0)> but
+it's known to be broken since Plack 0.9971, since C<$0> is now
+I<always> set to the .psgi file path even when you run it from
+plackup.
=head1 SEE ALSO
Modified: trunk/libplack-perl/lib/Plack/Server/ServerSimple.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libplack-perl/lib/Plack/Server/ServerSimple.pm?rev=69810&op=diff
==============================================================================
--- trunk/libplack-perl/lib/Plack/Server/ServerSimple.pm (original)
+++ trunk/libplack-perl/lib/Plack/Server/ServerSimple.pm Sun Feb 27 02:19:56 2011
@@ -1,6 +1,6 @@
package Plack::Server::ServerSimple;
use strict;
-our $VERSION = '0.9971';
+our $VERSION = '0.9972';
$VERSION = eval $VERSION;
use parent qw(Plack::Handler::HTTP::Server::Simple);
Modified: trunk/libplack-perl/lib/Plack/Util.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libplack-perl/lib/Plack/Util.pm?rev=69810&op=diff
==============================================================================
--- trunk/libplack-perl/lib/Plack/Util.pm (original)
+++ trunk/libplack-perl/lib/Plack/Util.pm Sun Feb 27 02:19:56 2011
@@ -105,6 +105,8 @@
my $_package = $_file;
$_package =~ s/([^A-Za-z0-9_])/sprintf("_%2x", unpack("C", $1))/eg;
+ _file_zero_check($_file) if $ENV{PLACK_ENV} eq 'development';
+
local $0 = $_file; # so FindBin etc. works
return eval sprintf <<'END_EVAL', $_package;
@@ -115,6 +117,27 @@
$app;
}
END_EVAL
+}
+
+sub _file_zero_check {
+ my $file = shift;
+ open my $fh, "<", $file or return;
+
+ my $code = join '', <$fh>;
+ if ($code =~ /(__FILE__\s+eq\s+\$0|\$0\s+eq\+__FILE__)/) {
+ warn <<WARNING
+Your PSGI file ($file) seems to use the following idiom, which is known to be broken since Plack 0.9971:
+
+ if ($1) {
+ called_from_cmdline();
+ }
+
+because now \$0 is _always_ localized to the PSGI file path you're evaluating. You should switch to other alternatives such as `unless (caller) {}`. See http://bit.ly/psgi-file-0 for details.
+
+This friendly warning and the code to generate this runs only when the Plack environment (-E) is set to 'development', and will go away in the next major release of Plack.
+
+WARNING
+ }
}
sub load_psgi {
More information about the Pkg-perl-cvs-commits
mailing list