FAQ
Hi!

I'm currently using the Session, Session::Store::DBIC,
and Session::State::Cookie plugins to track session data for
each user.

One of the things I'm doing is storing user queries into the
session:

$c->session->{queries} = {
1 => { deeper data structure here },
2 => { ... },
3 => { etc. }
};

Now, these queries are only preserved during the session.

I'd like to offer the possibility of saving this data and
make it available across sessions. I already thought about
setting the 'expires' value of the session to some extremely
high value, as mentioned in the Session plugin docs, but I
don't quite like the idea.

I prefer to have this data associated with a userid, and not
with a sessionid, so that the same user on two different
machines/browsers can get at her/his queries. So I've know
added authentication to my catalyst app, and I have already
login/logout functionality working (Authentication,
Authentication::Store::DBIC, Authentication::Credential::Password,
Authorization::Roles).

Now, if I want to have this session data stored into a
diffent db table and with additional data, I imagine I'd have
to write my own Session-Store-DBIC workalike ... or perhaps
it's easier to just dump the structure, encode it somehow
(base64?) and store this as text?

Anyone went that path? Perhaps this wheel is already
available from cpan? :)

Thanks for any pointer,

Fernan

Search Discussions

  • Daniel Westermann-Clark at Feb 9, 2007 at 8:19 pm

    On 2007-02-09 16:51:11 -0300, Fernan Aguero wrote:
    Now, if I want to have this session data stored into a diffent db
    table and with additional data, I imagine I'd have to write my own
    Session-Store-DBIC workalike ... or perhaps it's easier to just dump
    the structure, encode it somehow (base64?) and store this as text?
    Take a look at Session::Store::Delegate ... it was designed to be more
    extensible than Session::Store::DBIC.

    --
    Daniel Westermann-Clark
  • Jonathan Rockway at Feb 9, 2007 at 8:26 pm

    Fernan Aguero wrote:
    Anyone went that path? Perhaps this wheel is already
    available from cpan? :)
    Catalyst::Plugin::Session::PerUser?

    --
    package JAPH;use Catalyst qw/-Debug/;($;=JAPH)->config(name => do {
    $,.=reverse qw[Jonathan tsu rehton lre rekca Rockway][$_].[split //,
    ";$;"]->[$_].q; ;for 1..4;$,=~s;^.;;;$,});$;->setup;
  • Fernan Aguero at Feb 9, 2007 at 9:07 pm
    +----[ Jonathan Rockway (09.Feb.2007 17:32):
    Fernan Aguero wrote:
    Anyone went that path? Perhaps this wheel is already
    available from cpan? :)
    Catalyst::Plugin::Session::PerUser?
    +----]

    This seems a perfect fit, thanks!

    Fernan
  • Perrin Harkins at Feb 9, 2007 at 8:39 pm

    On 2/9/07, Fernan Aguero wrote:
    Now, if I want to have this session data stored into a
    diffent db table and with additional data, I imagine I'd have
    to write my own Session-Store-DBIC workalike ... or perhaps
    it's easier to just dump the structure, encode it somehow
    (base64?) and store this as text?
    I can't see why you wouldn't store it like any other data in a
    database table. Just make a table structure that fits it and use it
    the way you normally use your database.

    - Perrin
  • Yuval Kogman at Feb 9, 2007 at 10:18 pm

    On Fri, Feb 09, 2007 at 15:39:25 -0500, Perrin Harkins wrote:

    I can't see why you wouldn't store it like any other data in a
    database table. Just make a table structure that fits it and use it
    the way you normally use your database.
    <voice type="celebrity" class="cheesy,wash_out">
    Hi, my name is Yuval Kogman. You may know me from modules such as
    Catalyst::Plugin::Session and Catalyst::Plugin::Authentication. As
    the author of these modules I fully endorse the above comments
    <wink/>.
    </voice>

    Seriously though, PerUser was meant to make it trivial to migrate a
    guest session to a full model. Once you need data associated with a
    user then keep it with the user, don't create too many levels of
    indirection. The tools I wrote are filled with features that might
    be useful under certain scenarios, and admittedly they push the
    boundries of what is sometimes sane. I think this is valuable for
    during-development hacks, but that's no replacement for a fully
    thought out solution that is easy to maintain and understand.

    Cheers,

    --
    Yuval Kogman <nothingmuch@woobling.org>
    http://nothingmuch.woobling.org 0xEBD27418

    -------------- next part --------------
    A non-text attachment was scrubbed...
    Name: not available
    Type: application/pgp-signature
    Size: 189 bytes
    Desc: not available
    Url : http://lists.scsys.co.uk/pipermail/catalyst/attachments/20070210/d43ed3d4/attachment.pgp
  • Yuval Kogman at Feb 9, 2007 at 10:37 pm

    On Sat, Feb 10, 2007 at 00:19:01 +0200, Yuval Kogman wrote:

    <voice type="celebrity" class="cheesy,wash_out">
    Hi, my name is Yuval Kogman. You may know me from modules such as
    Crap, what a stupid misquote... you may *remember* me... sorry
    everyone.

    --
    Yuval Kogman <nothingmuch@woobling.org>
    http://nothingmuch.woobling.org 0xEBD27418

    -------------- next part --------------
    A non-text attachment was scrubbed...
    Name: not available
    Type: application/pgp-signature
    Size: 189 bytes
    Desc: not available
    Url : http://lists.scsys.co.uk/pipermail/catalyst/attachments/20070210/27322053/attachment.pgp
  • Jonathan Rockway at Feb 9, 2007 at 11:09 pm

    Yuval Kogman wrote:
    Hi, my name is Yuval Kogman. You may know me from modules such as
    Crap, what a stupid misquote... you may *remember* me... sorry
    everyone.
    If you're trying to sound like Troy McClure, it's "Hi, my name is $name.
    You may remember me from such modules as `Foo' and `Bar'." :)

    --
    package JAPH;use Catalyst qw/-Debug/;($;=JAPH)->config(name => do {
    $,.=reverse qw[Jonathan tsu rehton lre rekca Rockway][$_].[split //,
    ";$;"]->[$_].q; ;for 1..4;$,=~s;^.;;;$,});$;->setup;
  • Yuval Kogman at Feb 9, 2007 at 11:22 pm

    On Fri, Feb 09, 2007 at 17:09:50 -0600, Jonathan Rockway wrote:

    If you're trying to sound like Troy McClure, it's "Hi, my name is $name.
    You may remember me from such modules as `Foo' and `Bar'." :)
    That's what I was going for

    --
    Yuval Kogman <nothingmuch@woobling.org>
    http://nothingmuch.woobling.org 0xEBD27418

    -------------- next part --------------
    A non-text attachment was scrubbed...
    Name: not available
    Type: application/pgp-signature
    Size: 189 bytes
    Desc: not available
    Url : http://lists.scsys.co.uk/pipermail/catalyst/attachments/20070210/6dde2a99/attachment.pgp

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcatalyst @
categoriescatalyst, perl
postedFeb 9, '07 at 7:50p
activeFeb 9, '07 at 11:22p
posts9
users5
websitecatalystframework.org
irc#catalyst

People

Translate

site design / logo © 2022 Grokbase