[Dbix-class] RFC: InflateColumn::FS

Marc Mims marc at questright.com
Tue Sep 30 18:30:28 BST 2008


I recently watched Matt's lightning talk:
http://yapc.tv/2008/ye/lt/lt1-12-trout-arent-good-enough/

I've got some code I haven't shared with the world, yet, so perhaps it's
time.  It probably has bugs. :-)

So, for your comments, here's DBIx::Class::InflateColumn::FS.  (Please
suggest a better name.)

http://www.questright.com/perl/DBIx-Class-InflateColumn-FS-0.00000_01.tar.gz

I created a variation of this module after attempting to use
InflateColumn::File and finding it had some design limitations and
wasn't appropriate for my project.  I wasn't able to figure out how to
resolve the design limitations and keep InflateColumn::File backwards
compatible.  If someone can suggest how that can be done, that may be
preferable to adding yet-another-module.

InflateColumn::FS uses file system storage for BLOBS rather than storing
them in the DB.  It inflates columns to Path::Class::File objects.  It
can deflate from a Path::Class::File or a filehandle.

The deflated value, in this implementation, is simply the value 1 (or
undef for NULL columns).  The file name is derived from a path supplied
in column_info, the PK (assumed to be integer in this implementation),
and the column name.

A derived class is also supplied (InflateColumn::FS::SHA1) which
generates the storage file name using an SHA1 hash.  This allows the FS
columns from multiple tables, to be stored in the same tree rather than
requiring a separate tree for each column.

If this proves useful enough for inclusion in CPAN, it will be my first
CPAN upload.  A little mentoring would be appreciated.

I'm semifor on IRC, so feel free to shout at me on #dbix-class.

	-Marc



More information about the DBIx-Class mailing list