[Dbix-class] RFC: InflateColumn::FS

Moritz Onken onken at houseofdesign.de
Sat Oct 4 21:52:57 BST 2008


>
>
> You can override _fs_column_dir to provide directory tree nesting
> however you like.  I would still like to make this a config option,
> somehow, but this is a start.

Hi Marc,

I think your code covers everything. Well, actually there is one more
thing:

It would be great if one could specify a column which takes care of
storing the file extension. If such a column is present the filename
should contain this file extension. This is useful if you deliver
these files using a webserver which needs to know which MIME type
to send and guesses that from the file extension.

example:

   __PACKAGE__->add_columns(
       id => {
           data_type         => 'INT',
           is_auto_increment => 1,
       },
       file => {
           data_type => 'TEXT',
           is_fs_column => 1,
           fs_column_path => '/var/lib/myapp/myfiles',
       },
       extension => {
           data_type => 'TEXT',
           is_fs_extension => 1,
       },
   );

Another improvement I'd suggest is to handle the generation of the
filename with external modules like
http://search.cpan.org/perldoc?DBIx::Class::UUIDColumns does it.
And to be even more flexible you could factor out the generation
of the directories as external modules.

If you need any help with that I can contribute some code.
Aout the name: InflateColumn::File::Advanced/Turbo/Awesome/Extended
or something :-)

greets,

moritz



More information about the DBIx-Class mailing list