use TMPDIR env if it's defined in Store::File
Tatsuhiko Miyagawa [Sun, 13 Dec 2009 03:08:32 +0000 (19:08 -0800)]
lib/Plack/Middleware/Session.pm
lib/Plack/Session/Store/File.pm

index 9bbe61c..a7433d1 100644 (file)
@@ -54,7 +54,6 @@ Plack::Middleware::Session - Middleware for session management
 =head1 SYNOPSIS
 
   use Plack::Builder;
-  use Plack::Middleware::Session;
 
   my $app = sub {
       return [ 200, [ 'Content-Type' => 'text/plain' ], [ 'Hello Foo' ] ];
index 63b569e..8da664c 100644 (file)
@@ -15,7 +15,7 @@ use Plack::Util::Accessor qw[
 sub new {
     my ($class, %params) = @_;
 
-    $params{'dir'} ||= '/tmp';
+    $params{'dir'} ||= $ENV{TMPDIR} || '/tmp';
 
     die "Storage directory (" . $params{'dir'} . ") is not writeable"
         unless -w $params{'dir'};