Data::AnyXfer::Elastic::Import::Storage::Directory - Filesystem directory-based import storage
my $storage = Data::AnyXfer::Elastic::Import::Storage::Directory->new; $storage->set( company => 'Limited', address => 'Building One, Chiswick Park, 566 Chiswick High Road, London W4 5BE', regno => 1680058, ); $storage->save;
This module implements Data::AnyXfer::Elastic::Import::Storage, based on filesystem directories.
It uses temporary working directories, with persistence to an optional final target directory on "save" in Data::AnyXfer::Elastic::Import::Storage.
It represents items as single files, and can only store printable characters (i.e. any complex content should be serialised to a representable format before being passed to this module to store).
Optional. The final target directory that data should be persisted to.
Optional. The temporary directory data should be written to as operations are performed on this instance.
Optional. A string that will be appended to the end of every item name transparently when written to storage (will not be visible through the storage interface).
You can also use this for file extensions.
Optional. A string that will be prepended to the start of every item name transparently when written to storage (will not be visible through the storage interface).
Please see Data::AnyXfer::Elastic::Import::Storage for the interface definition and information.
my @item_names = $storage->search('test'); # e.g. returns ( 'a_test_item', 'this_has_test_in_the_name_also' )
Searches the storage instance for any item names containing the supplied substring.
Returns a list of matching item names.
my ( $status, $fh ) = $self->create_file_item('item_1', 'Hello World!');
Adds a new item, containing the supplied content. Fails if an item under the specified name already exists.
In scalar context returns a boolean indicating success or failure. In list context returns the boolean status value followed by a Path::Class::File object pointing to the underlying file.
my $item = $self->convert_item_name('some_random_string_with_unknown_chars');
Converts an arbritrary string to a format safe to be used by this storage backend as an item name.
This is not necessary on storage interface methods as this is handled transparently for you.
This convertion is most likely one-way (lossy). Because of the normalisation, different strings can point to the same item, e.g. 'some_string' and 'some-string' are considered the same item.
This software is copyright (c) 2019, Anthony Lucas.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Data::AnyXfer, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Data::AnyXfer
CPAN shell
perl -MCPAN -e shell install Data::AnyXfer
For more information on module installation, please visit the detailed CPAN module installation guide.