DBIx::Class::Fixtures::External::File - save and restore external data
my $fixtures = DBIx::Class::Fixtures ->new({ config_dir => 't/var/configs', config_attrs => { photo_dir => './t/var/files' }); { "sets": [{ "class": "Photo", "quantity": "all", "external": { "file": { "class": "File", "args": {"path":"__ATTR(photo_dir)__"} } } }] }
Sometimes your database fields are pointers to external data. The classic example is you are using DBIx::Class::InflateColumn::FS to manage blob data. In these cases it may be desirable to backup and restore the external data via fixtures.
This module performs this function and can also serve as an example for your possible custom needs.
This module defines the following methods
Accepts: Value of Database Field, $args
Given the value of a database field (which is some sort of pointer to the location of an actual file, and a hashref of args (passed in the args key of your config set), slurp up the file and return to to be saved in the fixure.
Accepts: Value of Database Field, Content, $args
Given the value of a database field, some blob content and $args, restore the file to the filesystem
See L<DBIx::Class::Fixtures> for author information.
See L<DBIx::Class::Fixtures> for contributor information.
See L<DBIx::Class::Fixtures> for license information.
To install DBIx::Class::Fixtures, copy and paste the appropriate command in to your terminal.
cpanm
cpanm DBIx::Class::Fixtures
CPAN shell
perl -MCPAN -e shell install DBIx::Class::Fixtures
For more information on module installation, please visit the detailed CPAN module installation guide.