in reply to HTML::Template problems
Since your main question has been adequately answered, I thought I would comment on the sub question you threw in there.
I am retrieving the sql from a sub called selectMsgFromDb that selects the proper sql query from a configuration module that has all the sql queries in a hash (Security problems???) and executes it, returning the data from the db.
There is nothing wrong with gathering all your SQL calls in one location and having the code pull them in when they are needed. Some would say that this is the proper way to handle SQL calls, since it leads to reuse of SQL statements, and less clutter in the code.
If you are looking for some direction in how this can be achieved easily and safely, then I would recommend you have a look at the Ima::DBI module which was built exactly for this purpose. It may be overkill if your script is small, but I think it is worth a look for ideas and direction regardless of whether you choose to use it.
Also, as the Ima::DBI docs suggest, have a look at Class::DBI which heavily uses the Ima::DBI and hides most of it's complexity. Again, it might be overkill for a small script, but it does wonders for organizing your Database access into clean and maintainable modules. You may even be able to avoid writing any SQL at all when using Class::DBI, as it is able to handle many of the most common ways a developer accesses data from a database.
- Cees
|
|---|