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

Bill Moseley moseley at hank.org
Wed Sep 30 04:35:05 GMT 2009


How does Storable know when to attempt to load ("use")  a thawed object's
module from disk?

We are adding new functionality to an application.  The new functionality
uses DBIx::Class and is a separate application deployed on separate
machines.  The machines need to share data (via Memcached) back and forth,
so all applications are configured to use the same cache.

The DBIC-based application has no problem reading this shared cache.  The
deserialized hash has data of different types, including many blessed
objects -- many that do not have
associated modules on those machines.

The problem, though, is when the DBIC-based application places a row object
into the cache and serializes it back then the old app can no longer read
the cache.  The application dies with:

Can't locate object method "result_source_instance" via package
"MyApp::Result::Artist" (perhaps you forgot to load
"MyApp::Result::Artist"?) at
/usr/local/share/perl/5.10.0/DBIx/Class/ResultSourceHandle.pm line 105

Actually, some machines don't have DBIx::Class installed and they die with:

Can't locate DBIx/Class/ResultSourceHandle.pm in @INC

As I mentioned, in the stored hash there are other objects other than the
Artist object.  And those are blessed into classes that do not have
associated modules on some machines, yet they do not generate these errors.
I'm wondering why some objects trigger an attempt to load the module and
some don't.


I can solve the second error above by installing DBIx::Class on all machines
that read this data via Storable.  But, is there a workaround to allow these
non-DBIC applcations
to thaw this hash and just ignore the DBIC-blessed objects?  There's other
data (not DBIx::Class objects) that also need to get stored in the cache and
passed to the old application.  This works fine w/o adding the DBIC objects
into the cache.

The old app doesn't need to read the DBIC objects, so I could use two caches
-- one just for the DBIC-based application and the other for inter-app state
sharing, but that's less than ideal.


-- =

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


More information about the DBIx-Class mailing list