Trim whitespace
[catagits/Catalyst-Plugin-Session-State-Stash.git] / lib / Catalyst / Plugin / Session / State / Stash.pm
index 438b910..ef0e9ad 100644 (file)
@@ -1,19 +1,19 @@
 package Catalyst::Plugin::Session::State::Stash;
-use base qw/Catalyst::Plugin::Session::State Class::Accessor::Fast/;
-
-#Need to look up which version of perl is required.
-#use 5.008;
-use strict;
-use warnings;
+use Moose;
+use 5.008;
 use MRO::Compat;
+use namespace::autoclean;
+
+extends 'Catalyst::Plugin::Session::State';
 
-our $VERSION = "0.10";
+our $VERSION = "0.12";
 
-BEGIN { __PACKAGE__->mk_accessors(qw/_deleted_session_id _prepared/) }
+has _deleted_session_id => ( is => 'rw' );
+has _prepared => ( is => 'rw' );
 
 sub _stash_key_components {
     my ($c) = @_;
-    my $config = $c->config->{'Plugin::Session'} || $c->config->{'session'};
+    my $config = $c->_session_plugin_config;
     return ($config->{stash_delim}) ?
         split $config->{stash_delim}, $config->{stash_key} :
         $config->{stash_key};
@@ -29,17 +29,12 @@ sub _get_session {
 
 sub _set_session {
     my ( $c,$key,$value) = @_;
-    
     $c->_get_session->{$key} = $value;
 }
 
 sub setup_session {
     my $c = shift;
-
-    $c->config->{'Plugin::Session'} 
-        and return $c->config->{'Plugin::Session'}->{stash_key} |= '_session';
-    $c->config->{'session'}->{stash_key}
-        ||= '_session';
+    $c->_session_plugin_config->{stash_key} ||= '_session';
 }
 
 sub prepare_action {
@@ -75,7 +70,6 @@ sub get_session_expires {
 
 sub set_session_expires {
     my ( $c, $expires ) = @_;
-    
     $c->_set_session(expires => time() + $expires);
     $c->maybe::next::method($expires)
 }
@@ -164,7 +158,7 @@ If present, splits stash_key at this character to nest. E.g. delim of '/'
 and key of '123/456' will store it as $c->stash->{123}->{456}
 
 =item expires
-    
+
 How long the session should last in seconds.
 
 =back
@@ -186,7 +180,7 @@ is pretty low on my list of priorities.
 Manual work may be involved to make better use of this.
 
 If you are writing a stateful web service with
-L<Catalyst::Plugin::Server::XMLRPC>, you will probably only have to deal with 
+L<Catalyst::Plugin::Server::XMLRPC>, you will probably only have to deal with
 loading, as when saving, the ID will already be on the stash.
 
 =head1 SEE ALSO
@@ -213,4 +207,3 @@ under the same terms as Perl itself.
 
 =cut
 
-1;