Samuel Kaufman > DBIx-Class-Fixtures > DBIx::Class::Fixtures::External::File

Download:
DBIx-Class-Fixtures-1.001024.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  11
Open  2
View/Report Bugs
Module Version: 1.001024   Source  

NAME ^

DBIx::Class::Fixtures::External::File - save and restore external data

SYNOPSIS ^

    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)__"}
                }
            }
        }]
    }

DESCRIPTION ^

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.

METHODS ^

This module defines the following methods

backup

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.

restore

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

AUTHOR ^

    See L<DBIx::Class::Fixtures> for author information.

CONTRIBUTORS ^

    See L<DBIx::Class::Fixtures> for contributor information.

LICENSE ^

    See L<DBIx::Class::Fixtures> for license information.
syntax highlighting: