NAME
Storage::Abstract::Driver::Subpath - Change root meta driver
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 meta driver 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.
CAVEATS
This driver caches the readonly state of its subdriver to make its behavior consistent with other meta drivers. You can call refresh
to make it recalculate the readonly state.