Oh Smart Ones,
Had a question for you - I have written some code which allows people to list a specific item (for the purpose of this question here), search through them and then contact the lister. Basically 4-5 perl functions plus 2-3 html template files doing all this stuff. Now the thing is that I want to reuse all the code, especially the perl code, so that they can list different types of items, and the search is specific to that item category, etc.
Now here's the catch, I could just copy all the code, rename the functions, change the variables and SQL statements and use it for the other item, but that seems like a sloppy solution. I would like to resuse the same code, but the thing is that (1) there has to be the ability to accept different variables for each of the different sections (2) the sql statements should be dependent on these different values, etc.
So should I build a library of what sql statements and what variables are assosciated with each category? or ......?
Please do let me know what you guys advise and also if I havent explained this clearly enough.
Thanks,
SP
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.