[CDBI] Re: Apps using Class::DBI

Perrin Harkins perrin at elem.com
Thu Mar 30 22:44:00 BST 2006


On Thu, 2006-03-30 at 00:26 +0100, Matt S Trout wrote:
> http://search.cpan.org/~mstrout/DBIx-Class-0.06000/lib/DBIx/Class/Schema.pm#txn_begin

I like the way you did this example.  It avoids the problems with code
refs, by making it a real sub with parameters.

The more common approach that I've seen is to use it like a block and
just use lexical variables from the enclosing scope, which makes it too
easy to leak memory with nested calls or to get confused about return
values.  If I need to use code refs for something again, I'll do it like
this.

- Perrin





More information about the ClassDBI mailing list