| [reply] [d/l] |
What do you mean by "business logic". I'm just trying to understand from more experienced Perl programmers on how to approach this issue from Perl. I have added my "starter" code suggestion and where I stuck.
| [reply] |
I'm just trying to understand from more experienced Perl programmers on how to approach this issue from Perl.
In general, we're happy to help, but please take into consideration that we're all volunteering our time here. If I open a question and see several pages worth of data with no code to run it against, that's going to take me a lot longer to wrap my head around, and if I'm busy, I'll have to set that question aside for later. A few bits of advice:
- Reread How do I post a question effectively? and Short, Self-Contained, Correct Example. Questions that are "self-contained" contain a piece of code that is short and demonstrates the question/problem, is runnable as-is (others just have to download and run it), and your sample data can either be presented as a separate file to download, or you can even embed it in the code using here docs (my $data = <<'END'; ... END) or the __DATA__ section.
- Is all the data you present in the root node really necessary for asking the question, or can some bits of the data structure be removed? Can you present the data structure in a more compact way? For example, { version => [ 'tcsh' ], group => 'pkgs' }, fits on a single line instead of six.
- Anything else you can do to make it easier for others to run the code helps. For example, it's possible to embed your expected output of the code into the script, using e.g. Test::More's is_deeply to compare the output your script is currently generating to the expected output. See also How to ask better questions using Test::More and sample data. (As it stands, your question has nine different snippets of expected output, and if I wanted to write some code, I'd have to copy-and-paste those all together myself, figuring out which snippet is what as I go along.)
- <update> And sorry to pile more on, but posting the wrong code is also something I'd suggest you try to avoid - consider that now, I have to worry that perhaps you made the same mistake in this root node? That's why self-contained, correct examples are best. </update>
All of these things will generally get you more answers, higher-quality answers, and faster answers.
| [reply] [d/l] [select] |
Well, good luck. I'll just note that I was not suggesting dumping Mongo. In fact I mentioned that you should be able to query your structured data there (https://docs.mongodb.com/manual/tutorial/query-embedded-documents/). I suggested marshalling your data for insertion into Mongo using a temporary SQL DB instead of the complex and hard-to-maintain Perl data manipulation routines you are struggling with.
The way forward always starts with a minimal test.
| [reply] |