pre-0.02 commit
[catagits/Web-Session.git] / lib / Plack / Session / Store / File.pm
index 63b569e..0d13ddf 100644 (file)
@@ -2,6 +2,9 @@ package Plack::Session::Store::File;
 use strict;
 use warnings;
 
+our $VERSION   = '0.02';
+our $AUTHORITY = 'cpan:STEVAN';
+
 use Storable ();
 
 use parent 'Plack::Session::Store';
@@ -15,7 +18,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'};
@@ -71,6 +74,13 @@ sub _deserialize {
     $self->deserializer->( $file_path );
 }
 
+sub dump_session {
+    my ($self, $session_id) = @_;
+    my $file_path = $self->_get_session_file_path( $session_id );
+    return {} unless -f $file_path;
+    $self->deserializer->( $file_path );
+}
+
 
 1;