Ok, so we have a field in our database called file_format and it is a string that when evaluated and $b is defined, will return a patch name with the bug number filled in.

The problem is that over time each person's way of putting $b into this template string varied based on their personal tastes. So we have all of the following in this column in the database.

p${b}.zip p{$b}.zip p$b.zip
and the problem with this comes when you want to create a SQL SELECT statement to pull out a row when one of the join criteria is this column. Because, instead of writing:
SELECT * FROM table WHERE file_format='p$b.zip'
I have to write
SELECT * FROM table WHERE file_format='p$b.zip' or file_format='p{$b}.zip' or file_format='p${b}.zip'

and I have the willies because I'm not sure if I have covered all the ways that such variable interpolation can take place.

On the other hand, you might comment on my dilemma as a lesson in business logic as discussed in davorg's "Data Munging with Perl". All business logic should be in classes and hence the policy for this field read and write processing should have been in a class where the template string was generated in invariant Perl code as opposed to however it was done here (I wasn't around when it was done and don't want to stress anyone in this poor economy for fear of being kicked out into the streets).


In reply to TMTOWTDI isn't best in this case by princepawn

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.