X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FPlugin%2FSession.pm;h=f306997dfa53f23f255df51099753de22e948b18;hb=4ccdbb079a08620a8a2979197786fffe2a09cb3f;hp=625a356a3ee82a43662e26a0132cf9108a7081f2;hpb=6687905d6813d8438037fdf1a1f095f876204529;p=catagits%2FCatalyst-Plugin-Session.git diff --git a/lib/Catalyst/Plugin/Session.pm b/lib/Catalyst/Plugin/Session.pm index 625a356..f306997 100644 --- a/lib/Catalyst/Plugin/Session.pm +++ b/lib/Catalyst/Plugin/Session.pm @@ -14,14 +14,15 @@ use Object::Signature (); our $VERSION = "0.04"; +my @session_data_accessors; # used in delete_session BEGIN { __PACKAGE__->mk_accessors( - qw/ + "_session_delete_reason", + @session_data_accessors = qw/ _sessionid _session _session_expires _session_data_sig - _session_delete_reason _flash _flash_stale_keys / @@ -201,12 +202,8 @@ sub delete_session { $c->delete_session_data("${_}:${sid}") for qw/session expires flash/; # reset the values in the context object - $c->$_(undef) for qw/ - _sessionid - _session - _session_expires - _session_data_sig - /; + # see the BEGIN block + $c->$_(undef) for @session_data_accessors; $c->_session_delete_reason($msg); } @@ -481,6 +478,18 @@ requests. This method will automatically create a new session and session ID if none exists. +=item session_expires + +=item session_expires $reset + +This method returns the time when the current session will expire, or 0 if +there is no current session. If there is a session and it already expired, it +will delete the session and return 0 as well. + +If the C<$reset> parameter is true, and there is a session ID the expiry time +will be reset to the current time plus the time to live (see +L). This is used when creating a new session. + =item flash This is like Ruby on Rails' flash data structure. Think of it as a stash that @@ -595,6 +604,13 @@ called by the C method if appropriate. Creates a new session id using C if there is no session ID yet. +=item validate_session_id SID + +Make sure a session ID is of the right format. + +This currently ensures that the session ID string is any amount of case +insensitive hexadecimal characters. + =item generate_session_id This method will return a string that can be used as a session ID. It is @@ -609,13 +625,6 @@ overridable in case you want to provide more random data. Currently it returns a concatenated string which contains: -=item validate_session_id SID - -Make sure a session ID is of the right format. - -This currently ensures that the session ID string is any amount of case -insensitive hexadecimal characters. - =over 4 =item * @@ -727,7 +736,7 @@ are automatically set: =item __expires -This key no longer exists. This data is now saved elsewhere. +This key no longer exists. Use C instead. =item __updated