Since the documentation for Class::DBI and Ima::DBI are a little too simple, the information is kinda difficult to piece together, however, having experimented around for a few minutes.. You can define your own arbitrary SQL statements, execute and then call Ima::DBI methods on them.. Something like this:
App::User->set_sql('getusers', 'select * from __TABLE__ where username
+ = ?');
To set up a method named sql_getusers, which can be passed a username, and later to use it:
my $sth = App::User->sql_getusers();
$sth->execute('fred');
my $hash = $sth->fetchall_hash();
Or any of the other fetch methods listed in Ima::DBI. This one actually gets you an array of hashrefs, one for each of the answers, containing column names as keys, and values in the values.
Class::DBI seems to be good in simple cases, but complex in complicated ones.. (whereas DBI is complex all over, but once you learn it, you'll be able to do everything..
C.