NAME
Storage::Abstract::Driver::Subpath - Change root metadriver
SYNOPSIS
# general file storage
my $storage = Storage::Abstract->new(
driver => 'directory',
directory => '/some/directory',
);
# subpath of the file storage for public files
my $public_storage = Storage::Abstract->new(
driver => 'subpath',
source => $storage,
subpath => '/public',
);
# these calls will return the same file
my $fh1 = $storage->retrieve('/public/file');
my $fh2 = $public_storage->retrieve('/file');
DESCRIPTION
This metadriver can modify another driver to use a different path than root. It will work as if the root of the "source" driver was changed to "subpath". It does the opposite of Storage::Abstract::Driver::Superpath.
It is impossible (as intended) to get files outside the "subpath" using this driver.
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.
subpath
Required - A path prefix for all paths passed to the "source" driver.