Catman...ctional(3pm)
π Catmandu::Transactional β the 3pm manual page, but make it make sense π
okay bestie, so this one is from the Perl user-contributed docs (that's the 3pm section, iykyk) and it's called Catmandu::Transactional. it's an optional role for transactional stores β optional being the key word, like the cute jacket you don't have to wear but slays when you do β¨
πΈ NAME πΈ
Catmandu::Transactional β the optional role for transactional stores π«Ά
π SYNOPSIS π
# bag will be untouched
my $store->transaction(sub {
$store->bag('books')->add({title => 'Time must have a stop'});
die;
});
notice how the comment says the bag stays untouched?? that's the whole point bestie β the die kills the transaction and everything rolls back like nothing happened π
π¦ METHODS π¦
β¨ transaction($sub) β¨
so transaction takes a coderef and runs it inside the context of a transaction. here's the tea:
- if an error gets thrown β the transaction rolls back π everything undoes itself
- if the code runs all the way through successfully β the transaction gets committed π it's canon now
β οΈ lowkey important: there is no support for nested transactions. if you calltransactioninside anothertransaction, the inner one just gets subsumed by its parent transaction β like, it's absorbed, no separate vibe of its own. periodt. π
and that's the whole page, no notes πβ¨
this lil gem came to you from perl v5.40.1, dated 2026-01-24 β drink some water, commit your transactions, and stan rollback safety ππ¦π
π¦ 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