I have a perl/MySQL website which is running well and suiting the client needs, but I'd be the first to admit, it's a bit rough. I'd be a bit embarrassed if one of you monks had to take it over from me, put it that way.
How it works is:
- If a URL on the site exists as a static file, it's served as normal.
- If not, Apache redirects to a single perl script.
- That script splits the path and acts accordingly,
- say the path is /chicago/south/drycleaners/j-smith-and-sons, that's the path to a specific business, so $mode = 'business' and the if($mode eq 'business'){ ... } block is invoked,
- but if it's just /chicago/south/drycleaners/ that's a list of all businesses in a certain category so the if($mode eq 'category'){ ... } block runs, and so on.
Things I need to fix:
- This single perl script is getting large and complex, so I should probably think about putting the different code sections into modules.
- It would be better to use a framework, though not a very complicated one -- would Catalyst be overkill for something like this? Maybe CGI::App? Maybe just moving those big blocks into MyApp::BusinessMode and MyApp::CategoryMode modules would be enough?
- More flexibility for the future when the client has new ideas.
- Like I said above, just generally more professionally organised code so that whoever works with it in future, including me, it's more logical and modular.
By the way, there's only reading from the database and HTML display involved. No updates or inserts, no authentication/personalisation, just pulling data, putting it into HTML::Template and output to the browser.
Any suggestions very gratefully received.
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.