http://www.perlmonks.org?node_id=285130

rkg has asked for the wisdom of the Perl Monks concerning the following question:

Hi folks --

I'm using Class::DBI, and I need an aggregate function, so as per the docs I'm using set_sql, as Class::DBI inherits from Ima::DBI. This works fine

Rk::M->set_sql(maxid => q(select max(m) from m)); my $sth = Rk::M->sql_maxid; $sth->execute; my ($max) = $sth->fetchrow_array;
However, the Class::DBI docs indicate this shorter form might work too:
Rk::M->set_sql(maxid => q(select max(m) from m)); my $max = Rk::M->maxid;
It doesn't, complaining it can't locate object method 'maxid' via package Rk::M.

Am I reading the docs wrong here? I get the sense Class::DBI always wants to return a Rk::M (or whatever) object, not a simple int, but perhaps that's a second problem here -- for now, I am wondering why Class::DBI isn't even executing the method.

Thanks for your advice.

rkg