Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Remove the source scanner for cheking __FILE__ cargo cult in Plack::U…
…til::load_psgi.
  • Loading branch information
miyagawa committed Jul 25, 2012
1 parent 348dc4f commit 3a9d947
Showing 1 changed file with 0 additions and 23 deletions.
23 changes: 0 additions & 23 deletions lib/Plack/Util.pm
Expand Up @@ -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

Expand All @@ -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;

Expand Down

0 comments on commit 3a9d947

Please sign in to comment.