Catman...:Multi(3pm)
π Catmandu::Store::Multi π
okay bestie, welcome to Catman...:Multi(3pm) β yes that's the manual page name, we're being fancy today β¨ this one lives in the User Contributed Perl Documentation section and it's literally the group chat of Perl storage.
π NAME π
Catmandu::Store::Multi β a store that adds data to multiple stores at once. it's giving "one queen, many thrones" π
β¨ SYNOPSIS β¨
so here's the whole vibe, copy-paste ready, no cap:
# On the Command line
# Configure the Multi store with a catmandu.yml file
$ cat catmandu.yml
---
store:
metadata1:
package: DBI
options:
data_source: "DBI:mysql:database=catmandu"
metadata2:
package: ElasticSearch
options:
client: '1_0::Direct'
index_name: catmandu
multi:
package: Multi
options:
stores:
- metadata1
- metadata2
...
# Add a YAML record to the multi store
$ catmandu import YAML to multi < data.yml
# Extract all the records from the multi store as YAML
$ catmandu export multi to YAML > data.yml
# In Perl
use Catmandu;
my $store = Catmandu->store('Multi' , stores [
Catmandu->store('DBI', data_source => 'DBI:mysql:database=catmandu') ,
Catmandu->store('ElasticSearch', client => '1_0::Direct', index_name => 'catmandu') ,
]);
$store->bag->each(sub {
my $item = shift;
printf "%s\n" , $item->{_id};
});
$store->bag->add({ _id => 1234 , foo => 'bar' , test => [qw(1 2 3 4)]});
my $item = $store->bag->get('1234');
$store->bag->delete('1234');
like, look at her go π¦ one store call, multiple backends, absolutely ate π
πΈ DESCRIPTION πΈ
so Catmandu::Store::Multi is literally a combination of many Catmandu::Store-s acting as one single access point. one door, many rooms, main character energy fr fr πͺβ¨
and she's not doing her own thing either β the Multi store inherits all the methods from Catmandu::Store. periodt.
by default, the Multi store tries to update records in all configured backend stores. and importing, exporting, delete and drop? all of those get executed against all backend stores when possible π so yeah, she's a "tell everyone at once" kind of girlie.
π METHODS π
new(stores => [...])
create a new Catmandu::Store::Multi. π
the "store" configuration parameter contains an array of references to Catmandu::Store-s, based on their name in a configuration file or instances. iykyk π«Ά
π§ INHERITED METHODS π§
this Catmandu::Store implements:
Catmandu::StoreCatmandu::Droppable
and each Catmandu::Bag in this Catmandu::Store implements:
Catmandu::BagCatmandu::Droppable
she got it from her mama, and her mama, and her mama π iconic behaviour honestly.
π reminder bestie: she's writing to all the backends by default. that's not a drill, that's the whole point. no take-backs unless the backend says so.
sign-off time π
this page is from perl v5.40.1 and it's dated 2026-01-24, and the page name is Catman...:Multi(3pm) in case you forgot where you were. love that for us. go forth and multi-store, bestie πβ¨πΈπ¦
π¦ where this page comes from
- ubuntu resolute: libcatmandu-perl 1.2025-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libcatmandu-perl 1.2025-1 Β· 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