Mojo::P...nsaction(3)
π NAME π
Mojo::Pg::Transaction β it's giving transaction, bestie π
β¨ SYNOPSIS β¨
okay so here's the whole vibe in four lines, no cap:
use Mojo::Pg::Transaction;
my $tx = Mojo::Pg::Transaction->new(db => $db);
$tx->commit;
like. that's it. that's the whole thing. iconic behavior honestly π«Ά
πΈ DESCRIPTION πΈ
Mojo::Pg::Transaction is a scope guard for DBD::Pg transactions β and the ones actually being used by Mojo::Pg::Database, to be specific. so like, it holds your transaction's hand and makes sure things get handled. main character energy, but for your database π
π¦ ATTRIBUTES π¦
Mojo::Pg::Transaction implements the following attributes. yes bestie, there's a list, and yes, we're reading all of it πβ¨
π db
my $db = $tx->db;
$tx = $tx->db(Mojo::Pg::Database->new);
this is the Mojo::Pg::Database object that this transaction belongs to. it's the whole "who's your database" of it all.
β οΈ heads up: this attribute is weakened. so it does NOT keep the database object alive on its own. don't be out here thinking you can drop your $db and have the transaction carry it β that's not the vibe. π
π₯ METHODS π₯
Mojo::Pg::Transaction inherits all the methods from Mojo::Base, and then it adds these brand new ones on top. it's giving "raised by Mojo::Base, thriving on its own" π§
β commit
$tx->commit;
commits the transaction. do it. seal the deal. periodt β¨
π new
my $tx = Mojo::Pg::Transaction->new;
my $tx = Mojo::Pg::Transaction->new(db => Mojo::Pg::Database->new);
my $tx = Mojo::Pg::Transaction->new({db => Mojo::Pg::Database->new});
constructs a brand new Mojo::Pg::Transaction object. three ways to do it, pick your fighter π
π SEE ALSO π
go read these too, i'm literally begging:
Mojo::PgMojolicious::Guides- <https://mojolicious.org>
iykyk π
and that's the whole page, bestie!! π this lil masterpiece is from perl v5.42.0, dated 2026-01-17, and it lives in the User Contributed Perl Documentation section of the manual. go forth and commit responsibly π π«Ά
π¦ where this page comes from
- fedora 44: perl-Mojo-Pg 4.28-2.fc44 Β· Artistic-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms