Reviews by

cpanratings
 

RSS

Class-DBI (0.96) ****

I really enjoy Class::DBI, it has made a couple projects relatively painless and fun. But this could be a much more powerul module if there was more powerful documentation. The current documentation forces you to experiment and divine things from Ima::DBI or surf wishfully for related modules on CPAN, but it actually is not that hard to make new queries for all of your classes at once, or to define new ones at runtime.

I have wondered if some speed problems I had were due to Class::DBI, reading the comments here it seems so, at least in part.

I have had trouble (undoubtedly my fault) with objects that forgot to load more than the Essential attributes when asked for them, so sometimes would force load of the entire object to solve that problem.

Some of the errors I have often had:

Can't locate object method "name" via package "WebApp::Company" and similar. In this case, I wanted to say $companyname = $user->person->company->name but Data::Dumper showed that $user->person->company returned an object blessed as WebApp::Company but it only included the Essential method "id". I had to re-retrieve the Company object.

Subroutine WebApp::Coach::sql_allids redefined at /usr/lib/perl5/site_perl/5.8.0/Ima/DBI.pm line 375.

search_allids() already exists at /var/www/lib/WebApp/Utils.pm line 1243.

prepare_cached(select now()) statement handle DBIx::ContextualFetch::st=HASH(0x901bf44) still active at /usr/lib/perl5/site_perl/5.8.0/Ima/DBI.pm line 391.

The above errors are undoubtedly my fault but the messages seem oblique and due to design issues which were not obvious on my first, second, and tenth readings of Class::DBI documentation. I am not worried about them now although possibly worried about potential memory leaks if I used it in mod_perl is this a reasonable worry?

A lot more information on optimization, and creation of preset queries that use both sql and perl logic would be nice. There was a hint in the has_many section about this, but as an example of what not to do. I think that in the real world you end up needing to do some things that are not covered by Class::DBI and these are potential targets for future development.

Also on use with CGI::Application and sessions (which I liked). I think I saved some time storing object in session table between pages.

I have to do some profiling to see how much time it is using but for a project where I was willing to trade execution time for speed in development, I was quite happy. Now I'd like to see some more documentation or more in the cookbook, I think this is the highest priority before other new methods.