Jump to content

Documentation: Difference between revisions

Added Perl 6
(Add Racket information)
(Added Perl 6)
Line 605:
=={{header|Perl}}==
Perl's documentation mechanism is called [http://perldoc.perl.org/perlpod.html POD (Plain Old Documentation)]. Basically, any line that starts with an equal sign followed by a word (e.g. <tt>=head1</tt>) starts a documentation comment; and it lasts until a line that begins with <tt>=cut</tt>. Many formatting commands are recognized; for example, a line beginning with <tt>=item</tt> starts a section for an item, text wrapped in <tt>I< ... ></tt> is italicized, text wrapped in <tt>C< ... ></tt> is formatted as code, etc. See the [http://perldoc.perl.org/perlpod.html perlpod] and [http://perldoc.perl.org/perlpodspec.html perlpodspec] manuals for more details about the format.
 
=={{header|Perl 6}}==
Similarly to Perl 5, Perl 6 is documented using [http://perlcabal.org/syn/S26.html Pod] (a redesigned version of POD). However, it's not simply ignored by the parser as it happened in Perl 5, it's an internal part of the language spec and can be used to attach documentation objects to almost any part of the code.
 
<lang Perl6>
#= it's yellow
sub marine { ... }
say &marine.WHY; # "it's yellow"
 
#= a shaggy little thing
class Sheep {
#= not too scary
method roar { 'roar!' }
}
say Sheep.WHY; # "a shaggy little thing"
say say Sheep.^find_method('roar').WHY; # "not too scary"
</lang>
 
A compiler has a built-in <code>--doc</code> switch that will generate documentation from a given source file.
 
 
=={{header|PHP}}==
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.