r69785 - in /branches/upstream/libplack-perl/current: Changes META.yml 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
Sat Feb 26 18:12:48 UTC 2011


Author: jawnsy-guest
Date: Sat Feb 26 18:11:50 2011
New Revision: 69785

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=69785
Log:
[svn-upgrade] new version libplack-perl (0.9972)

Modified:
    branches/upstream/libplack-perl/current/Changes
    branches/upstream/libplack-perl/current/META.yml
    branches/upstream/libplack-perl/current/lib/Plack.pm
    branches/upstream/libplack-perl/current/lib/Plack/Request.pm
    branches/upstream/libplack-perl/current/lib/Plack/Response.pm
    branches/upstream/libplack-perl/current/lib/Plack/Runner.pm
    branches/upstream/libplack-perl/current/lib/Plack/Server/ServerSimple.pm
    branches/upstream/libplack-perl/current/lib/Plack/Util.pm

Modified: branches/upstream/libplack-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libplack-perl/current/Changes?rev=69785&op=diff
==============================================================================
--- branches/upstream/libplack-perl/current/Changes (original)
+++ branches/upstream/libplack-perl/current/Changes Sat Feb 26 18:11:50 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: branches/upstream/libplack-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libplack-perl/current/META.yml?rev=69785&op=diff
==============================================================================
--- branches/upstream/libplack-perl/current/META.yml (original)
+++ branches/upstream/libplack-perl/current/META.yml Sat Feb 26 18:11:50 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: branches/upstream/libplack-perl/current/lib/Plack.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libplack-perl/current/lib/Plack.pm?rev=69785&op=diff
==============================================================================
--- branches/upstream/libplack-perl/current/lib/Plack.pm (original)
+++ branches/upstream/libplack-perl/current/lib/Plack.pm Sat Feb 26 18:11:50 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: branches/upstream/libplack-perl/current/lib/Plack/Request.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libplack-perl/current/lib/Plack/Request.pm?rev=69785&op=diff
==============================================================================
--- branches/upstream/libplack-perl/current/lib/Plack/Request.pm (original)
+++ branches/upstream/libplack-perl/current/lib/Plack/Request.pm Sat Feb 26 18:11:50 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: branches/upstream/libplack-perl/current/lib/Plack/Response.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libplack-perl/current/lib/Plack/Response.pm?rev=69785&op=diff
==============================================================================
--- branches/upstream/libplack-perl/current/lib/Plack/Response.pm (original)
+++ branches/upstream/libplack-perl/current/lib/Plack/Response.pm Sat Feb 26 18:11:50 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: branches/upstream/libplack-perl/current/lib/Plack/Runner.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libplack-perl/current/lib/Plack/Runner.pm?rev=69785&op=diff
==============================================================================
--- branches/upstream/libplack-perl/current/lib/Plack/Runner.pm (original)
+++ branches/upstream/libplack-perl/current/lib/Plack/Runner.pm Sat Feb 26 18:11:50 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: branches/upstream/libplack-perl/current/lib/Plack/Server/ServerSimple.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libplack-perl/current/lib/Plack/Server/ServerSimple.pm?rev=69785&op=diff
==============================================================================
--- branches/upstream/libplack-perl/current/lib/Plack/Server/ServerSimple.pm (original)
+++ branches/upstream/libplack-perl/current/lib/Plack/Server/ServerSimple.pm Sat Feb 26 18:11:50 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: branches/upstream/libplack-perl/current/lib/Plack/Util.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libplack-perl/current/lib/Plack/Util.pm?rev=69785&op=diff
==============================================================================
--- branches/upstream/libplack-perl/current/lib/Plack/Util.pm (original)
+++ branches/upstream/libplack-perl/current/lib/Plack/Util.pm Sat Feb 26 18:11:50 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