|Think about Loose Coupling|
How to approach this problem, or should I ignore it?by jedikaiti (Pilgrim)
|on Apr 07, 2010 at 17:26 UTC||Need Help??|
jedikaiti has asked for the
wisdom of the Perl Monks concerning the following question:
OK, Monks, I have more of a conceptual question this time. I have a whole mess of data in a big ol' nested HoHoH (and the occasional array, too). Format like what's below:
I have some code that, right now, goes through this data and, for each command, comes up with an HTML table like this (example for command 3 in the data above):
99% of the time, this is fine. But there's a couple of commands that have a LOT of subfields - like 20 of them - and that just doesn't fit well.
What I am trying to determine is if there's a relatively easy way to break the big ones down into multiple tables. Like put the first 5 subfields in the first table, cut it off, then put the next 5 into another table, and so on. If this is going to be a PITA, or just take forever to code up, then I have my boss' OK to ignore the problem - we're talking about < 5 commands out of close to 300 that this applies to.
The existing code just uses a foreach to iterate through (and sort) the commands, an if/else to check for the existence of subfields, and if there are subfields, a for to iterate through those.
So, what do you guys think? Any brilliant insights? Should I leave the sleeping puppies alone, or can you think of a simple/quick way to handle this?
Swiss Army Nerd