Catman...:Index(3pm)
π NAME π
Catmandu::FileBag::Index β the lil' glow-up that flags a Bag as a FileStore Index. That's it, that's the whole job, and she does it flawlessly. β¨
This one lives in the User Contributed Perl Documentation, section 3pm, bestie. Pull up a chair. π
β¨ SYNOPSIS β¨
Like, here's the whole vibe in one go, no notes:
use Catmandu;
my $store = Catmandu->store('Simple' , root => 't/data');
# List all containers
$store->bag->each(sub {
my $container = shift;
print "%s\n" , $container->{_id};
});
# Add a new folder
$store->bag->add({ _id => '1234' });
# Get the v
my $files = $store->bag->files('1234');
# Add a file to the files
$files->upload(IO::File->new('<foobar.txt'), 'foobar.txt');
# Stream the contents of a file
$files->stream(IO::File->new('>foobar.txt'), 'foobar.txt');
# Delete a file
$files->delete('foobar.txt');
# Delete a folder
$store->bag->delete('1234');
Obsessed. You spin up a store, you loop over every container and print its _id, you add a folder with _id => '1234', you grab the $files for it, you upload, you stream, you delete the file, you delete the whole folder. A whole little lifecycle. π
ngl the comment in the original literally says # Get the v and I am NOT touching it, that's canon now, it's iconic, leave her alone π
πΈ DESCRIPTION πΈ
Every Catmandu::FileBag is literally just a Catmandu::Bag, and she inherits all its methods. That's the family tree, that's the lore, that's the tea. π«Ά
π¦ METHODS π¦
π files($id) π
Returns the Catmandu::FileBag for this Catmandu::FileStore, and that FileBag is holding all the files. Every single one. She's got them. She's not letting go. π
β SEE ALSO β
Catmandu::FileStoreCatmandu::FileBag
Go read those too, bestie, they're the whole support system. π
Okay so the official receipts: this is perl v5.36.0, dated 2022-12-10, and it ships as part of Catman...:Index(3pm). Slay, mwah, bye. π πβ¨
π¦ 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