I'm currently extending the online help of a software system we have here. It has a normal command line where typing in 'help' spills some general help text (more or less a list of known commands with short descriptions).
Now I'd like to do something like 'help <command>' for a more detailed help. Until now, the implementation is very trivial and in my opinion error prone:
Now I'd like to place some variables into the here documents. E.g. the commands shouldn't be typed in explicitedly, but just the $command variable should be interpolated. HOwever, it seems to me, that here documents are a very static construct not allowing this "template mechanism".... } elsif($command eq '?' or $command eq 'find') { &message(<<'EOT'); Help menu for the command 'find': SYNOPSIS find <phrase> - find <phrase> in lexicon and output al +l meanings found. DESCRIPTION Both commands are optional. If given a phrase, it is default blahblahblah EOT } elsif($command eq 'add') { &message(<<'EOT'); Help menu for the command 'add' SYNOPSIS add <lex> <entry> - add an entry <entry> to the lexicon <l +ex> DESCRIPTION This adds an entry to the lexicon with the name/type <lex>, <entry> must have proper syntax or it will be rejected. If blahblahblah EOT ...
Am I overseeing something?
Bye
PetaMem
In reply to Interpolating in Here Documents? by PetaMem
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |