NAME

Storage::Abstract::Driver::Superpath - Mount under directory metadriver

SYNOPSIS

# public file storage
my $public_storage = Storage::Abstract->new(
	driver => 'directory',
	directory => '/some/directory',
);

# make public files visible under /public
my $storage = Storage::Abstract->new(
	driver => 'superpath',
	source => $public_storage,
	superpath => 'public',
);

# these calls will return the same file
my $fh1 = $public_storage->retrieve('/file');
my $fh2 = $storage->retrieve('/public/file');

DESCRIPTION

This metadriver does the opposite of Storage::Abstract::Driver::Subpath - it mounts its source driver under a passed "superpath" directory. It will work as if the entire filesystem was moved to that directory. Any file path must have "superpath" prepended to it explicitly in order to successfully target a file.

CUSTOM INTERFACE

Attributes

source

Required - A Storage::Abstract instance. It can be coerced from a hash reference, which will be used to call "new" in Storage::Abstract.

superpath

Required - A path prefix which will be added to all files in the "source" driver.

CAVEATS

This driver does not allow any file operation outside of "superpath". For most operations it just means it will act as if the file was not present, but for store it will throw a Storage::Abstract::X::Readonly instead (even though the storage may not report being readonly). For this reason, it works best when underlying storage is marked as readonly.