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


In reply to Re: HTML::Template problems by cees
in thread HTML::Template problems by stonecolddevin

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.