transaction $bdh => code{ ... } #### transaction $bdh, sub { ... } #### Some error commit not safe after errors, transaction rolled back at Transactions.pm line 123 commit not safe after errors, transaction rolled back at Transactions.pm line 123 #### use Transactions; package Foo; sub begin_work { my $self = shift(); print "CALL begin_work on $self->{name}\n"; } sub rollback { my $self = shift(); print "CALL rollback on $self->{name}\n"; } sub commit { my $self = shift(); print "CALL commit on $self->{name}\n"; } sub new { bless {name => $_[1]}, $_[0]; } package main; $foo = new Foo 'jenda'; $foo1 = new Foo 'pavel'; $foo2 = new Foo 'martin'; #eval { transaction $foo => code{ print "Start of the outer transaction\n"; # die "Some error\n"; # eval { transaction [$foo1, $foo2] => code{ print "Start of the inner transaction\n"; die "Some error\n"; print "End of the inner transaction\n"; }; # }; # if ($@) {print "Error in inner trans: $@\nIGNORING!!!\n"}; # die "Some error\n"; print "End of the outer transaction\n"; }; #}; transaction $foo => code{ print "Start of the outer transaction\n"; print "End of the outer transaction\n"; };