Commit | Line | Data |
569c7126 |
1 | =pod |
2 | |
3 | =encoding UTF-8 |
4 | |
5 | =head1 NAME |
6 | |
7 | Catalyst::Plugin::Session::State::Stash - Maintain session IDs using the stash |
8 | |
9 | =head1 VERSION |
10 | |
11 | version 0.14 |
12 | |
13 | =head1 SYNOPSIS |
14 | |
15 | use Catalyst qw/Session Session::State::Stash Session::Store::Foo/; |
16 | |
17 | =head1 DESCRIPTION |
18 | |
19 | An alternative state storage plugin that allows you some more flexibility in |
20 | dealing with session storage. This plugin loads and saves the session ID from |
21 | and to the stash. |
22 | |
23 | =head1 METHODS |
24 | |
25 | =over 4 |
26 | |
27 | =item delete_session_id |
28 | |
29 | Deletes the session. Unfortunately I've been unable to squash a bug that will |
30 | stop you from opening a new session in the same execution, however. |
31 | Patches welcome! |
32 | |
33 | =item get_session_id |
34 | |
35 | Gets the current session id. |
36 | |
37 | =item set_session_id |
38 | |
39 | Sets the session id to the C<shift>. |
40 | |
41 | =item get_session_expires |
42 | |
43 | Gets when the current session expires. |
44 | |
45 | =item set_session_expires |
46 | |
47 | Sets how many seconds from now the session should expire. |
48 | |
49 | =back |
50 | |
51 | =head1 EXTENDED METHODS |
52 | |
53 | =over 4 |
54 | |
55 | =item prepare_action |
56 | |
57 | Loads the id off the stash. |
58 | |
59 | =item setup_session |
60 | |
61 | Defaults the C<stash_key> parameter to C<_session>. |
62 | |
63 | =back |
64 | |
65 | =head1 CONFIGURATION |
66 | |
67 | =over 4 |
68 | |
69 | =item stash_key |
70 | |
71 | The name of the hash key to use. Defaults to C<_session>. |
72 | |
73 | =item stash_delim |
74 | |
75 | If present, splits C<stash_key> at this character to nest. E.g. a C<delim> of '/' |
76 | and C<stash_key> of '123/456' will store it as $c->stash->{123}->{456} |
77 | |
78 | =item expires |
79 | |
80 | How long the session should last in seconds. |
81 | |
82 | =back |
83 | |
84 | For example, you could stick this in F<MyApp.pm>: |
85 | |
86 | __PACKAGE__->config( 'Plugin::Session' => { |
87 | stash_key => 'session_id', |
88 | }); |
89 | |
90 | =head1 BUGS |
91 | |
92 | You can't delete a session then create a new one. If this is important to you, |
93 | patches welcome! |
94 | |
95 | =head1 CAVEATS |
96 | |
97 | Manual work may be involved to make better use of this. |
98 | |
99 | =for stopwords stateful |
100 | |
101 | If you are writing a stateful web service with |
102 | L<Catalyst::Plugin::Server::XMLRPC>, you will probably only have to deal with |
103 | loading, as when saving, the ID will already be on the stash. |
104 | |
105 | =head1 SEE ALSO |
106 | |
107 | L<Catalyst>, L<Catalyst::Plugin::Session>, L<Catalyst::Plugin::Session::State>, |
108 | L<Catalyst::Plugin::Session::State::Cookie> (what you probably want). |
109 | |
110 | =head1 AUTHOR |
111 | |
112 | James Laver <perl -e 'printf qw/%s@%s.com cpan jameslaver/'> |
113 | |
114 | =head1 CONTRIBUTORS |
115 | |
116 | =over 4 |
117 | |
118 | =item * |
119 | This module is derived from L<Catalyst::Plugin::Session::State::Cookie> code. |
120 | Thanks to anyone who wrote code for that. |
121 | |
122 | =item * |
123 | Thanks to Kent Fredric for a patch for nested keys |
124 | |
125 | =back |
126 | |
127 | =for stopwords Florian Ragwitz Karen Etheridge Tomas Doran James Laver |
128 | |
129 | =over 4 |
130 | |
131 | =item * |
132 | |
133 | Florian Ragwitz <rafl@debian.org> |
134 | |
135 | =item * |
136 | |
137 | Karen Etheridge <ether@cpan.org> |
138 | |
139 | =item * |
140 | |
141 | Tomas Doran <bobtfish@bobtfish.net> |
142 | |
143 | =item * |
144 | |
145 | James Laver <jjl@baozi.local> |
146 | |
147 | =item * |
148 | |
149 | James Laver <james@jameslaver.com> |
150 | |
151 | =back |
152 | |
153 | =head1 COPYRIGHT AND LICENSE |
154 | |
155 | This software is copyright (c) 2009 by James Laver. |
156 | |
157 | This is free software; you can redistribute it and/or modify it under |
158 | the same terms as the Perl 5 programming language system itself. |
159 | |
160 | =cut |