Okay, getting a strange problem with Class::DBI.
Using the example from the usage.
Music::Artist->set_sql(most_cds => qq{
SELECT artist.id, COUNT(cd.id) AS cds
FROM artist, cd
WHERE artist.id = cd.artist
GROUP BY artist.id
ORDER BY cds DESC
LIMIT 10
});
my @artists = Music::Artist->search_most_cds();
I've also setup the temp column in Music/Artist.pm
__PACKAGE__->columns(TEMP => qw/cds/);
Everything appears to be fine and if I execute the SQL directly in the database I get the appropriate results with the counts that are correct.
However, when the perl code spits out the data it appears to be missing the count (temporary cds column) on the first result. I've confirmed this by using Data::Dumper and this is what I'm seeing on my end (edited to match example).
$VAR1 = bless( { '__triggers' => {}, '_class_trigger_results' => [], '
+id' => '1' }, 'Music::Artist' );
$VAR2 = bless( { '__triggers' => {}, '_class_trigger_results' => [], '
+cds' => '2', 'id' => '2' }, 'Music::Artist' );
It's really late and that may have something to do with why I'm stumped but it's not making any sense what-so-ever.
UPDATE:
This only appears to be happening in mod_perl. I'm continuing to investigate. Any ideas, tips, feedback is appreciated.