Christopher Fields
and 1 contributors


Bio::DB::DBI::TransactionListener - a simple transaction listener


    # see method section


This object is the contract and at the same time a simple (neutral) implementation of a transaction listener.

Transaction listeners are notified before and after commit and rollback on transactions as represented by a Bio::DB::DBI::Transaction objects.

Note that this is a very loose contract in the sense that it is not enforced. Therefore it serves more as a guideline of what you *can* do rather than what you have to do.

You may currently choose between 3 different options on how to listen to transactions:

    - write your own transaction listener that inherits from this
      class and overrides methods as suitable, then use your class to
      add listeners to Transactions

    - let your adaptor or persistent object module inherit from this
      class and thereby make it a listener-compliant object that you
      can then use to register with Transactions

    - register any object with Transaction that implements at least
      one of the methods defined here (if it implements none then
      what's the point?). Transaction will only call the methods
      defined here if the listener actually implements them.


Mailing Lists

User feedback is an integral part of the evolution of this and other Bioperl modules. Send your comments and suggestions preferably to the Bioperl mailing list. Your participation is much appreciated.                  - General discussion  - About the mailing lists


Please direct usage questions or support issues to the mailing list:

rather than to the module maintainer directly. Many experienced and reponsive experts will be able look at the problem and quickly address it. Please include a thorough description of the problem with code and data examples if at all possible.

Reporting Bugs

Report bugs to the Bioperl bug tracking system to help us keep track of the bugs and their resolution. Bug reports can be submitted via the web:

AUTHOR - Hilmar Lapp

Email hlapp at

Describe contact details here


Additional contributors names and emails here


The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _


 Title   : new
 Usage   : my $obj = Bio::DB::DBI::TransactionListener->new();
 Function: Builds a new Bio::DB::DBI::TransactionListener object 
 Returns : an instance of Bio::DB::DBI::TransactionListener
 Args    :


 Title   : register_sub
 Usage   :
 Function: Register an anonymous code block for being executed in
           one of the listener methods.

           This method is probably mostly useful for testing purposes,
           but who knows.

           You may call this as a class method or an object method.

 Example :
 Returns : an instance of this class with the supplied anonymous
           function overriding the specified listener method
 Args    : the code reference to register

           the name(s) of the interface method(s) to register it for
           (optional, if not specified the code block will be
           registered for all 4 methods)

TransactionListener interface methods

The following methods define the interface for TransactionListeners.


 Title   : before_commit
 Usage   :
 Function: Called before a commit is issued. 

           Any listener may veto a pending commit by returning
           false. The default implementation returns true.

 Example :
 Returns : TRUE if the transaction is good to be committed, and
           FALSE if it is vetoed.
 Args    : none


 Title   : after_commit
 Usage   :
 Function: Called after a commit was issued. 

           The default implementation here does nothing.

 Example :
 Returns : ignored
 Args    : none


 Title   : before_rollback
 Usage   :
 Function: Called before a rollback is issued. 

           A listener cannot veto a pending rollback. The return value
           and even thrown exceptions will be ignored by Transaction.

 Example :
 Returns : ignored
 Args    : none


 Title   : after_rollback
 Usage   :
 Function: Called after a rollback is issued. 

 Example :
 Returns : ignored
 Args    : none