| 1 | package Jifty::Web::Session::None; | ||
| 2 | |||
| 3 | use warnings; | ||
| 4 | use strict; | ||
| 5 | |||
| 6 | =head1 NAME | ||
| 7 | |||
| 8 | Jifty::Web::Session::None - A null session handler for jifty | ||
| 9 | |||
| 10 | =head1 DESCRIPTION | ||
| 11 | |||
| 12 | Jifty depends on its sessions to keep users logged in, to store | ||
| 13 | continuations and to allow developers to store user-specific data. | ||
| 14 | In general, you don't want to disable them. But sometimes, the | ||
| 15 | development benefits of Jifty lead you to build applications that | ||
| 16 | genuinely don't want per-user sessions. That's where | ||
| 17 | C<Jifty::Web::Session::None> comes in. By specifying that you want | ||
| 18 | to use C<Jifty::Web::Session::None> as your Jifty session handler, | ||
| 19 | you tell Jifty to avoid ever reading, writing or storing a user session. | ||
| 20 | No cookies get set. Nothing gets stored in the database. | ||
| 21 | |||
| 22 | =head1 USAGE | ||
| 23 | |||
| 24 | In your C<etc/config.yml>: | ||
| 25 | |||
| 26 | --- | ||
| 27 | framework: | ||
| 28 | Web: | ||
| 29 | SessionClass:: Jifty::Web::Session::None | ||
| 30 | |||
| 31 | =cut | ||
| 32 | |||
| 33 | =head1 METHODS | ||
| 34 | |||
| 35 | All methods in this class are dummy methods which do no work. This class | ||
| 36 | mocks the API provided by C<Jifty::Web::Session>. | ||
| 37 | |||
| 38 | =cut | ||
| 39 | |||
| 40 | =head2 new | ||
| 41 | |||
| 42 | Takes no arguments. Returns a L<Jifty::Web::Session::None>. | ||
| 43 | |||
| 44 | =cut | ||
| 45 | |||
| 46 | sub new { | ||
| 47 | my $class = shift; | ||
| 48 | return bless {}, $class; | ||
| 49 | } | ||
| 50 | |||
| 51 | =head2 id | ||
| 52 | |||
| 53 | Returns false. | ||
| 54 | |||
| 55 | =cut | ||
| 56 | |||
| 57 | sub id {return undef } | ||
| 58 | |||
| 59 | =head2 create | ||
| 60 | |||
| 61 | Returns true. | ||
| 62 | |||
| 63 | =cut | ||
| 64 | |||
| 65 | sub create { return 1} | ||
| 66 | |||
| 67 | =head2 load | ||
| 68 | |||
| 69 | Returns true. | ||
| 70 | |||
| 71 | =cut | ||
| 72 | |||
| 73 | sub load { return 1} | ||
| 74 | |||
| 75 | =head2 unload | ||
| 76 | |||
| 77 | Returns true. | ||
| 78 | |||
| 79 | =cut | ||
| 80 | |||
| 81 | sub unload { return 1} | ||
| 82 | |||
| 83 | =head2 loaded | ||
| 84 | |||
| 85 | Returns true. | ||
| 86 | |||
| 87 | =cut | ||
| 88 | |||
| 89 | sub loaded { return 1}; | ||
| 90 | |||
| 91 | =head2 get | ||
| 92 | |||
| 93 | Returns false. | ||
| 94 | |||
| 95 | =cut | ||
| 96 | |||
| 97 | sub get { return undef;} | ||
| 98 | |||
| 99 | =head2 set | ||
| 100 | |||
| 101 | Returns false. | ||
| 102 | |||
| 103 | =cut | ||
| 104 | |||
| 105 | sub set { return undef;} | ||
| 106 | |||
| 107 | =head2 remove | ||
| 108 | |||
| 109 | Returns true. | ||
| 110 | |||
| 111 | =cut | ||
| 112 | |||
| 113 | sub remove { return 1} | ||
| 114 | |||
| 115 | =head2 set_continuation | ||
| 116 | |||
| 117 | Returns false. | ||
| 118 | |||
| 119 | =cut | ||
| 120 | sub set_continuation { return undef} | ||
| 121 | |||
| 122 | =head2 get_continuation | ||
| 123 | |||
| 124 | Returns false. | ||
| 125 | |||
| 126 | =cut | ||
| 127 | |||
| 128 | sub get_continuation {return undef} | ||
| 129 | |||
| 130 | =head2 remove_continuation | ||
| 131 | |||
| 132 | Returns false. | ||
| 133 | |||
| 134 | =cut | ||
| 135 | |||
| 136 | sub remove_continuation {return undef} | ||
| 137 | |||
| 138 | =head2 continuations | ||
| 139 | |||
| 140 | Returns false. | ||
| 141 | |||
| 142 | =cut | ||
| 143 | |||
| 144 | sub continuations { return undef} | ||
| 145 | |||
| 146 | =head2 set_cookie | ||
| 147 | |||
| 148 | Returns false. | ||
| 149 | |||
| 150 | =cut | ||
| 151 | |||
| 152 | sub set_cookie { return undef} | ||
| 153 | |||
| 154 | =head2 cookie_name | ||
| 155 | |||
| 156 | Returns false. | ||
| 157 | |||
| 158 | =cut | ||
| 159 | |||
| 160 | sub cookie_name { return undef} | ||
| 161 | |||
| 162 | =head2 expires | ||
| 163 | |||
| 164 | Returns false. | ||
| 165 | |||
| 166 | =cut | ||
| 167 | |||
| 168 | sub expires {return undef} | ||
| 169 | |||
| 170 | 1; |