Grokbase
Topics Posts Groups | in
x
[ help ]

[Catalyst] Re: Subsessions?

View PostFlat  Thread  Threaded | < Prev - Next >
Rainer Clasen [Catalyst] Re: Subsessions?
paperclip | +1 vote
[ Profile | Reply to group ] [ Flat  Thread  Threaded ]
Yuval Kogman wrote:
> sub session {
[...]
> return $self->NEXT::session->{$sub} ||= {};


Zbigniew Lukasiak wrote:
> On 9/27/07, Rainer Clasen <bj@zuto.de> wrote:
> > So I'm searching for something functional similar to:
> > http://paneris.net/cgi-bin/cvsweb.cgi/SubSession/SubSessions.html?rev=1.3
> >
>
> Interesting. I usually use GET parameters for that - but I can
> imagine where it would become not enough.

Thanks to both of you. Your responses helped a lot to sort my Ideas and
hack up my initial "poor man" / proof of concept solution:

- subsession ids are generated with c->generate_session_id from the
  Session Plugin.
- subsession data is stored as $c->session->{SUBSESSION}{$ssid}
- ssid is picked from $c->param
- uri_for automagically sets ssid
- all internal links are constructed with uri_for()
- change of subsession data doesn't yet cause a new ssid to be assigned.
  This comes later. Up to then it has to be done manually with
  subsession_next.
- You cannot change subsession data after you've shown the subsession id
  to the client (i.e. you've used uri_for).

So far this seems to work fine, but it needs a bit more testing (and
documentation).


Rainer

--
KeyID=759975BD fingerprint=887A 4BE3 6AB7 EE3C 4AE0 B0E1 0556 E25A 7599 75BD _______________________________________________
List: [email protected: Cat...@lists.rawmode.org]
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/

Attachment: Subsession.pm

Thread : [Catalyst] Subsessions?
1)
Rainer Clasen Hello, there are currently two Problems I could easily solve with subsessions. After saving some...
2)
Yuval Kogman A somewhat naive idea: sub session { my $c = shift; if ( my $sub = $self->subsession_id ) { return...
3)
Rainer Clasen Thanks to both of you. Your responses helped a lot to sort my Ideas and hack up my initial "poor...
paperclip
4)
Zbigniew Lukasiak Interesting. I usually use GET parameters for that - but I can imagine where it would become not...
5)
A. Pagaltzis You’re asking the wrong question. Sessions are a bad idea in general; application state should...
6)
Yuval Kogman For what it's worth, I agree. Sessions are like a half assed model with automagical fetching of the...
7)
Rainer Clasen I also consider "normal" sessions evil. My subsessions are still ugly, but at least they keep the...
spacer
View PostFlat  Thread  Threaded | < Prev - Next >