Skip to content
Browse files

Merge branch 'master' of github.com:plack/Plack

  • Loading branch information...
2 parents 4f301f6 + b8eadec commit c0591df30928d27a064a3c4f9d08f80b7e233233 @miyagawa miyagawa committed Sep 28, 2012
Showing with 24 additions and 4 deletions.
  1. +11 −1 lib/Plack/Handler/Apache1.pm
  2. +11 −1 lib/Plack/Handler/Apache2.pm
  3. +2 −2 t/Plack-Request/cookie.t
View
12 lib/Plack/Handler/Apache1.pm
@@ -20,7 +20,17 @@ sub preload {
sub load_app {
my($class, $app) = @_;
return $apps{$app} ||= do {
- local $ENV{MOD_PERL}; # trick Catalyst/CGI.pm etc.
+ # Trick Catalyst, CGI.pm, CGI::Cookie and others that check
+ # for $ENV{MOD_PERL}.
+ #
+ # Note that we delete it instead of just localizing
+ # $ENV{MOD_PERL} because some users may check if the key
+ # exists, and we do it this way because "delete local" is new
+ # in 5.12:
+ # http://perldoc.perl.org/5.12.0/perldelta.html#delete-local
+ local $ENV{MOD_PERL};
+ delete $ENV{MOD_PERL};
+
Plack::Util::load_psgi $app;
};
}
View
12 lib/Plack/Handler/Apache2.pm
@@ -28,7 +28,17 @@ sub preload {
sub load_app {
my($class, $app) = @_;
return $apps{$app} ||= do {
- local $ENV{MOD_PERL}; # trick Catalyst/CGI.pm etc.
+ # Trick Catalyst, CGI.pm, CGI::Cookie and others that check
+ # for $ENV{MOD_PERL}.
+ #
+ # Note that we delete it instead of just localizing
+ # $ENV{MOD_PERL} because some users may check if the key
+ # exists, and we do it this way because "delete local" is new
+ # in 5.12:
+ # http://perldoc.perl.org/5.12.0/perldelta.html#delete-local
+ local $ENV{MOD_PERL};
+ delete $ENV{MOD_PERL};
+
Plack::Util::load_psgi $app;
};
}
View
4 t/Plack-Request/cookie.t
@@ -8,11 +8,11 @@ use Plack::Request;
my $app = sub {
my $req = Plack::Request->new(shift);
- is $req->cookies->{undef}, undef;
+ is $req->cookies->{undef}, undef, "non-existing keys return undef";
is $req->cookies->{Foo}, 'Bar';
is $req->cookies->{Bar}, 'Baz';
is $req->cookies->{XXX}, 'Foo Bar';
- is $req->cookies->{YYY}, 0;
+ is $req->cookies->{YYY}, 0, "When we get multiple values we return the first one (which e.g. Apache does too)";
$req->new_response(200)->finalize;
};

0 comments on commit c0591df

Please sign in to comment.
Something went wrong with that request. Please try again.