The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

02-gethelp.t - just a program for testing

EOT my $helpusage = <<EOT; =head1 SYNOPSIS

        02-gethelp.t [something]

EOT my $helpdescr = <<EOT; =head1 DESCRIPTION

This is a longer description of the thing.

EOT

my $helpbody = <<EOT; =head1 PARAMETERS

These are the general rules for specifying parameters to this program:

        02-gethelp.t [-]s [-]xyz [-]s=value --long [-[-]]long=value - [files/stuff]

The [ ] notation means that the enclosed - is optional, saving typing time for really lazy people. Note that "xyz" as well as "-xyz" mention three short options, opposed to the long option "--long". In trade for the shortage of "-", the separator for additional unnamed parameters is mandatory (supply as many "-" grouped together as you like;-).

You mention the options to change parameters in any order or even multiple times. They are processed in the oder given, later operations overriding/extending earlier settings. Using the separator "--" stops option parsing An only mentioned short/long name (no "=value") means setting to 1, which is true in the logical sense. Also, prepending + instead of the usual - negates this, setting the value to 0 (false). Specifying "-s" and "--long" is the same as "-s=1" and "--long=1", while "+s" and "++long" is the sames as "-s=0" and "--long=0".

There are also different operators than just "=" available, notably ".=", "+=", "-=", "*=" and "/=" for concatenation / appending array/hash elements and scalar arithmetic operations on the value. Arrays are appended to via "array.=element", hash elements are set via "hash.=name=value". You can also set more array/hash elements by specifying a separator after the long parameter line like this for comma separation:

        --array/,/=1,2,3  --hash/,/=name=val,name2=val2

The available parameters are these, default values (in Perl-compatible syntax) at the time of generating this document following the long/short names:

config, I (array)
        []

Which configfile(s) to use (overriding automatic search in likely paths); special: just -I or --config causes printing a current config file to STDOUT

help, h (scalar)
        0

Show the help message. Value 1..9: help level, par: help for paramter par (long name) only.

Additional fun with negative values, optionally followed by comma-separated list of parameter names: -1: list par names, -2: list one line per name, -3: -2 without builtins, -10: dump values (Perl style), -11: dump values (lines), -100: print POD.

parm1, a (scalar)
        'a string'

help text for scalar 1

parm2, b (scalar)
        'a number'

help text for scalar 2

parmA, A (array)
        [
          1,
          2,
          'free',
          'beer'
        ]

help text for array A

parmH, H (hash)
        {
          donkey => 'animal',
          key => 3
        }

help text for hash H

parmX (scalar)
        'Y'

help text for last one (scalar)

ADDENDUM

Just some note with accidental B<POD> syntax. plus something indented, also with POD

VERBATIM

A verbatim section

AUTHOR

Thomas Orgis <some\@place.tld>

LICENSE AND COPYRIGHT

Copyright (c) 1234 mine