Catman...:Index(3pm)

πŸ“¦
version 1.16 Β· 4 versions
, in debian bookworm, ubuntu noble

πŸ’– 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::FileStore
  • Catmandu::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