in reply to RFC: Transactions.pm

What might be interesting is to extend this to other actions as well -- creating/updating/deleting/renaming files, sending emails, etc. As you say, anything that can receive the 'begin_work', 'commit' and 'rollback' messages can participate. Making the messages observations (using something like, oh, Class::Observable) would be very flexible as well and you'd get for free object/class/subroutine registration to receive the messages. Just a thought.

I've found the Unit Of Work pattern most helpful with this. Martin Fowler used to have a lengthy description of it on his site but he went and published a book and changed the description to a simple summary. (The book is highly recommended, BTW.)

Chris
M-x auto-bs-mode

Replies are listed 'Best First'.
Re: Re: RFC: transactions.pm
by Juerd (Abbot) on Apr 27, 2003 at 15:42 UTC

    Making the messages observations (using something like, oh, Class::Observable) would be very flexible as well and you'd get for free object/class/subroutine registration to receive the messages. Just a thought.

    I don't understand its documentation, and think the module is too advanced. Perhaps it's one of those things for which you have to know Java in order to understand. I made transactions.pm to be tiny and easy, and using a heavy module would not help it be easy to use.

    Juerd # { site => 'juerd.nl', plp_site => 'plp.juerd.nl', do_not_use => 'spamtrap' }

      Sorry if I wasn't clear -- I wasn't suggesting that what you've proposed would be made better using the module. Just that if you ever decided to expand it (which often happens IME) it might be useful to look into further decoupling the transactionable (is that a word?) resources from the action doing the commit/rollback.

      I don't think the Observer/Observable pattern is too advanced for common use. In fact I think it's one of the simplest (and quickest) ways you can achieve decoupling among disparate processes. Maybe the documentation for Class::Observable is a little too long, but that often happens with simple, flexible little tools that can be used in lots of different ways.

      Good luck!

      Chris
      M-x auto-bs-mode