[Dbix-class] Re: Using Storable with DBIx::Class - Can't locate object method "result_source_instance"

Bill Moseley moseley at hank.org
Thu Oct 1 17:59:09 GMT 2009


On Thu, Oct 1, 2009 at 12:33 AM, Alexander Hartmaier <
alexander.hartmaier at t-systems.at> wrote:

> I'd like this more because the $artist knows about his schema, using a
> different one might end up in unexpected results:
>
> $schema->thaw( $artist->freeze );
>

True.  Well at for the freeze step anyway.  Have to supply a $schema on
thaw.  (Plus, freeze is not a method on $artist).


Back to my original question.  Which turned out to be two questions.

First, I never got anyone to comment (commit) on how to save dbic objects in
a session hash.  Is that not done by anyone?  Or is it:

$c->session->{foo} =3D $schema->freeze( $foo );

Then later:

$foo =3D $c->$schema->thaw( $c->session->{foo} ) if exists $c->session->{fo=
o};

I assume running the serialized $foo though Storable again is not a
significant performance issue.


And my original question:

Legacy application has session data in Memcached.  Runs on separate
machines.  No DBIx::Class installed (and not sure could install if
dependencies cause breakage).  New Catalyst application should transparently
handle some new pages on application.  Users should be able to move
seemlessly (and transparently) between two applications.  Two applications
need to share state information in session back-and-forth.

If dbic is not on legacy machines then can't have dbic objects in any data
thawed by Storable.

Suggestions?  Use two different sessions on the new (dbic) application?

Do ugly hack on legacy app so that Storeable won't try and load dbic?

{
    no warnings 'redefine';
    sub DBIx::Class::ResultSet::STORABLE_thaw {}
    sub DBIx::Class::ResultSourceHandle::STORABLE_thaw {}

    $INC{'DBIx/Class/ResultSet.pm'} =3D 1;
    $INC{'DBIx/Class/ResultSourceHandle.pm'} =3D 1;

    DBIx::Class::ResultSourceHandle->overload::OVERLOAD(q/""/ =3D> sub {});
    DBIx::Class::ResultSet->overload::OVERLOAD(q/""/ =3D> sub {});
}




-- =

Bill Moseley
moseley at hank.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20091001/d95=
a7b90/attachment.htm


More information about the DBIx-Class mailing list