use namespace::clean -except => 'meta';
-our $VERSION = '0.27';
+our $VERSION = '0.28';
$VERSION = eval $VERSION;
my @session_data_accessors; # used in delete_session
sub session {
my $c = shift;
- $c->_session || $c->_load_session || do {
+ my $session = $c->_session || $c->_load_session || do {
$c->create_session_id_if_needed;
$c->initialize_session_data;
};
+
+ if (@_) {
+ my $new_values = @_ > 1 ? { @_ } : $_[0];
+ croak('session takes a hash or hashref') unless ref $new_values;
+
+ for my $key (keys %$new_values) {
+ $session->{$key} = $new_values->{$key};
+ }
+ }
+
+ $session;
}
sub keep_flash {
This method will automatically create a new session and session ID if none
exists.
+ You can also set session keys by passing a list of key/value pairs or a
+ hashref.
+
+ $c->session->{foo} = "bar"; # This works.
+ $c->session(one => 1, two => 2); # And this.
+ $c->session({ answer => 42 }); # And this.
+
=item session_expires
=item session_expires $reset
kmx C<kmx@volny.cz>
+Florian Ragwitz (rafl) C<rafl@debian.org>
+
+Kent Fredric (kentnl)
+
And countless other contributers from #catalyst. Thanks guys!
=head1 COPYRIGHT & LICENSE