Doc improvements for C::P::Session
[catagits/Catalyst-Plugin-Session.git] / lib / Catalyst / Plugin / Session.pm
index 7c1d78d..a1d625c 100644 (file)
@@ -207,15 +207,32 @@ storage and client side tickets required to maintain session data.
 
 =head1 SYNOPSIS
 
-    use Catalyst qw/Session Session::Store::FastMmap Session::State::Cookie/;
+    # To get sessions to "just work", all you need to do is use these plugins:
+
+    use Catalyst qw/
+      Session
+      Session::Store::FastMmap
+      Session::State::Cookie
+      /;
+
+       # you can replace Store::FastMmap with Store::File - both have sensible
+       # default configurations (see their docs for details)
+
+       # more complicated backends are available for other scenarios (DBI storage,
+       # etc)
+
+
+    # after you've loaded the plugins you can save session data
+    # For example, if you are writing a shopping cart, it could be implemented
+    # like this:
 
     sub add_item : Local {
         my ( $self, $c ) = @_;
 
         my $item_id = $c->req->param("item");
 
-        # $c->session is stored across requests, so
-        # other actions will see these values
+        # $c->session is a hash ref, a bit like $c->stash
+        # the difference is that it' preserved across requests
 
         push @{ $c->session->{items} }, $item_id;
 
@@ -227,7 +244,7 @@ storage and client side tickets required to maintain session data.
 
         # values in $c->session are restored
         $c->stash->{items_to_display} =
-            [ map { MyModel->retrieve($_) } @{ $c->session->{items} } ];
+          [ map { MyModel->retrieve($_) } @{ $c->session->{items} } ];
 
         $c->forward("MyView");
     }
@@ -247,6 +264,24 @@ made by the same client.
 
 This plugin links the two pieces together.
 
+=head1 RECCOMENDED BACKENDS
+
+=over 4
+
+=item Session::State::Cookie
+
+The only really sane way to do state is using cookies.
+
+=item Session::Store::File
+
+A portable backend, based on Cache::File.
+
+=item Session::Store::FastMmap
+
+A fast and flexible backend, based on Cache::FastMmap.
+
+=back
+
 =head1 METHODS
 
 =over 4
@@ -281,6 +316,12 @@ C<session expired>
 
 =back
 
+=back
+
+=item INTERNAL METHODS
+
+=over 4
+
 =item setup
 
 This method is extended to also make calls to
@@ -472,7 +513,10 @@ session hash when the hash is first created.
 
 =head1 AUTHORS
 
-
+Andy Grundman
+Christian Hansen
+Yuval Kogman, C<nothingmuch@woobling.org>
+Sebastian Riedel
 
 =head1 COPYRIGHT & LICNESE