/usr/share/perl5/Mojo/Pg/Transaction.pm is in libmojo-pg-perl 2.35-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | package Mojo::Pg::Transaction;
use Mojo::Base -base;
has 'db';
sub DESTROY {
my $self = shift;
if ($self->{rollback} && (my $dbh = $self->{dbh})) { $dbh->rollback }
}
sub commit {
my $self = shift;
$self->{dbh}->commit if delete $self->{rollback};
if (my $db = $self->db) { $db->_notifications }
}
sub new {
my $self = shift->SUPER::new(@_, rollback => 1);
my $dbh = $self->{dbh} = $self->db->dbh;
$dbh->begin_work;
return $self;
}
1;
=encoding utf8
=head1 NAME
Mojo::Pg::Transaction - Transaction
=head1 SYNOPSIS
use Mojo::Pg::Transaction;
my $tx = Mojo::Pg::Transaction->new(db => $db);
$tx->commit;
=head1 DESCRIPTION
L<Mojo::Pg::Transaction> is a scope guard for L<DBD::Pg> transactions used by
L<Mojo::Pg::Database>.
=head1 ATTRIBUTES
L<Mojo::Pg::Transaction> implements the following attributes.
=head2 db
my $db = $tx->db;
$tx = $tx->db(Mojo::Pg::Database->new);
L<Mojo::Pg::Database> object this transaction belongs to.
=head1 METHODS
L<Mojo::Pg::Transaction> inherits all methods from L<Mojo::Base> and
implements the following new ones.
=head2 commit
$tx->commit;
Commit transaction.
=head2 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});
Construct a new L<Mojo::Pg::Transaction> object.
=head1 SEE ALSO
L<Mojo::Pg>, L<Mojolicious::Guides>, L<http://mojolicious.org>.
=cut
|