I've been looking around the net for some good examples but I'm missing something.

Can someone show me an example of using CGI::Application with HTML::Template to query a mysql database...say just "select * from dvd" and displaying it into the template? Just real basic and simple. Mainly I cant figure out how to return the result set from mysql into the template.

Yes I realize that, I'm using the DBI module. Can I just get an example? We can skip the main file and just go straight to the .pm file, and skip all the initialization stuff. Just when I have queried 'select * from dvd' how do I send it to the template. Im looking at your TMPL_LOOP article, but could I have a more straight forward example.

So I have:

Code

while(@row = $sth->fetchrow_array){ (how do I send results to the template from here)... }

It happens to the best of us. My posts are nearly always covered in multiple edits, often because of that very reason. I'm surprised I remembered, I've been using DBIx::Class for along time now, it makes life easier.

I've often thought about using DBIx::Class but never have. The main reason is probably due to a decision change we had in upper management. Some key management person doesn't like Perl so now all my perl apps need to be rewritten in PHP (which I can't stand using). The odd thing is that a good portion of our most important 3rd party apps (such as RT) are written in Perl and we're not about to get rid of them. Even stranger is that they like writing apps in AutoHotKey and say it's better than perl.

Definitely worth playing around with it if you find the time, or when you begin a personal project, I only wish I had used it sooner. I'm with you on PHP too, I learnt both PHP and Perl together early on, but wouldn't even consider using PHP for a new project nowadays, I can only describe PHP from my experience as being clunky.