Catman...ctional(3pm)

πŸ“¦
version 1.2025 Β· 4 versions
, in ubuntu resolute, ubuntu stonking

πŸ’– 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 call transaction inside another transaction, 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