Permalink
Browse files

Remove the source scanner for cheking __FILE__ cargo cult in Plack::U…

…til::load_psgi.
  • Loading branch information...
1 parent 348dc4f commit 3a9d947c9dbad7489476c32d33c3da0f69da1b96 @miyagawa miyagawa committed Jul 25, 2012
Showing with 0 additions and 23 deletions.
  1. +0 −23 lib/Plack/Util.pm
View
@@ -110,8 +110,6 @@ sub _load_sandbox {
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
local @ARGV = (); # Some frameworks might try to parse @ARGV
@@ -125,27 +123,6 @@ package Plack::Sandbox::%s;
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\s+__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 {
my $stuff = shift;

0 comments on commit 3a9d947

Please sign in to comment.