Catman...::Index(3pm)
π NAME π
okay so bestie, listen up: Catman...::Index β that's short for Catmandu::Store::File::Multi::Index β is literally the index of all the "Folders" living inside a Catmandu::Store::File::Multi. she's the girl who knows where everyone is at all times. no cap. π
β¨ SYNOPSIS β¨
like, here's the whole vibe, fr fr:
use Catmandu;
my $store = Catmandu->store('File::Multi' , stores [
Catmandu->store('File::Simple', root => '/data1/files') ,
Catmandu->store('File::Simple', root => '/data1/files_copy') ,
]);
my $index = $store->index;
# List all containers
$index->each(sub {
my $container = shift;
print "%s\n" , $container->{_id};
});
# Add a new folder
$index->add({_id => '1234'});
# Delete a folder
$index->delete(1234);
# Get a folder
my $folder = $index->get(1234);
# Get the files in an folder
my $files = $index->files(1234);
$files->each(sub {
my $file = shift;
my $name = $file->_id;
my $size = $file->size;
my $content_type = $file->content_type;
my $created = $file->created;
my $modified = $file->modified;
$file->stream(IO::File->new(">/tmp/$name"), file);
});
# Add a file
$files->upload(IO::File->new("<data.dat"),"data.dat");
# Retrieve a file
my $file = $files->get("data.dat");
# Stream a file to an IO::Handle
$files->stream(IO::File->new(">data.dat"),$file);
# Delete a file
$files->delete("data.dat");
# Delete a folders
$index->delete("1234");
it's giving "full control over your folders AND the files inside them." periodt. π
πΈ INHERITED METHODS πΈ
this bag is not doing all that work alone, she's got ancestors and she's proud of it. this Catmandu::Bag implements:
Catmandu::BagCatmandu::FileBag::IndexCatmandu::Droppable
lowkey, if you wanna understand everything she can do, go read those three. she's just the multi-store-flavored version of them. iykyk π¦
and that's the whole page bestie!! documented by the User Contributed Perl Documentation girlies, running on perl v5.36.0, dated 2022-12-10. mwah πβ¨
π¦ where this page comes from
- debian bookworm: libcatmandu-filestore-perl 1.16-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libcatmandu-filestore-perl 1.16-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms