Documentation for declarator
blocks assembled from the following types:
From Perl 6 pod
Declarator blocks differ from the others by not having a specific type, instead they are attached to some source code.
Declarator blocks are introduced by a special comment: either
#=, which must be immediately followed by either a space or an opening bracket. If followed by a space, the block is terminated by the end of line; if followed by one or more opening brackets, the block is terminated by the matching sequence of closing brackets.
Blocks starting with
#| are attached to the code after them, and blocks starting with
#= are attached to the code before them.
Since declarator blocks are attached to source code, they can be used to document classes, roles, subroutines etc.
WHY method can be used on these classes, roles, subroutines etc. to return the attached Pod value.
sub duel(Magician , Magician )say Magician.WHY; # OUTPUT: «Base class for magicians␤»say .WHY.leading; # OUTPUT: «Fight mechanics␤»say .WHY.trailing; # OUTPUT: «Magicians only, no mortals.␤»
These declarations can extend multiple blocks:
* Numbers turn into strings* Regexes operate on said strings* C<with> topicalizes and places result into)sub search-in-seq( Int , Int )* topic* decont operator»
By using a matched pair of parenthesis constructs such as
«» the comments can extend multiple lines. This format, however, will not translate to a multi-line display by