PetaMem has asked for the wisdom of the Perl Monks concerning the following question:
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Interpolating in Here Documents?
by Abigail-II (Bishop) on Jul 24, 2002 at 11:12 UTC | |
|
Re: Interpolating in Here Documents?
by tadman (Prior) on Jul 24, 2002 at 11:30 UTC | |
by Abigail-II (Bishop) on Jul 24, 2002 at 11:45 UTC | |
by tadman (Prior) on Jul 24, 2002 at 12:24 UTC | |
by frankus (Priest) on Jul 24, 2002 at 13:10 UTC |