On 2020-07-26 03:06, mick crane wrote:
On Sat, 25 Jul 2020 14:55:35 -0700 David Christensen wrote:
It's been a while, but Linux-Apache-MySQL-Perl worked for me back in the day:
I'm not very good at this and wondered how to do it and thought could have things in a hash of hashes. As you tend to stick with a limited variety of recipes wouldn't be that extensive for personal use. After sorting out input.my %food=( "ham sandwich"=>{ cal=> .4, protein=>.2, fiber=>.3, }, "cauliflower cheese"=>{ cal=> .8, protein=>.3, fiber=>.1, }, ); my $calories= $food{$ARGV[0]}{cal}*$ARGV[1]; and add it to a weekly and daily totals file.
Perl data structures and algorithms can work when needs are few, simple, and fixed. The UI is command-line options and arguments to the Perl script. Data is stored in CSV or TSV files, and accessed with a library. Reports are generated with a PDF library. The key is that everything must fit into memory at once.
As complexity, change, and/or size increase, a database management system and SQL become necessary.
David