I'm concerned about things like putting the Apache::Request object into a closure, and getting issues like this :
Calls to Apache::Request's param method sometimes end the program and return no data.
And generally, if any other variables persist from request to request just because I used them in a closure, that would be annoying. (Of course, sometimes I want things to persist, and closures are helpful, but I don't do that in the context of calling a method for doing a database transaction).
e.g. I wanted to avoid doing this :
my $object;
do_transaction(code => sub {....$object->update..})
On second though, maybe the above is okay, since once the anonymous sub goes away, the reference to $object does too, so maybe I'm being unnecessarily cautious.