up to this day i have been able to struggle myself through that behemoth that is called Perl, but now i am in need of assistance.
i have inherited a piece of corporate software that makes my eyes bleed and my brain hurt. i am tasked to refactor it (at least there is SOME sanity in this) prior to implement new features. for corporate concerns i cannot post any "real" code. i try to get along with pseudo-code.
the software in question is a Perl module (used in a web-app) that receives three lists. first is a list of "group fields" (like 'username', 'book_id'), second is a list of "value fields" (like 'no_of_book_sales', 'comission_total'), third is an optional list containg filter definitions. the fields may come from up to 4 different tables. it returns the SQL to make a 'sensible' query to our database.
the parameters come from a web fronted that is designed to make it easy for our clients to create user designed queries via browser. depending on the incoming query fields the module decides from which table to select which fields in which order. there are also lots of optimizations and special cases (most of them to ensure a tight search when filtering) which are handled by a nightmarish construction of try catch, if and elseif blocks. not to mention that beast of a dispatch table that is alone capable of getting you 3 grey hairs (per day you work on it).
a very important special case is the "stats" table of which we have 3 instances. "stats_all", "stats_fast", "stats_faster". the last two are condensed (by dropping group fields and summing) versions of stats_all, each about 20%-30% of the size the bigger table. each table has a different duration. the data in stats_all only lasts 3 months, the data in stats_fast 1year and the data in stats_faster lasts (hopefully) for ever.
The current module investigate the "wanted fields" lists and selects the appropriate table to use.
At least, the connections between the source tables are relatively easy to handle. the mentioned "3 tier table" is always leading and there are only left joins.
Honestly, I have no idea how to tackle this. I read about sql-dictionaries, SQL::Abstract (which is unfriendly to nesting anonymous sub queries), and others.
someone got a cluebat for me?
In reply to Inheriting Bullsh!t by alaska.saedelere
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |