Documentation: Difference between revisions

Content added Content deleted
m (→‎{{header|Perl 6}}: newline suppression)
Line 609: Line 609:
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 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.
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 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>
<lang Perl6>#= it's yellow
#= it's yellow
sub marine { ... }
sub marine { ... }
say &marine.WHY; # "it's yellow"
say &marine.WHY; # "it's yellow"
Line 620: Line 619:
}
}
say Sheep.WHY; # "a shaggy little thing"
say Sheep.WHY; # "a shaggy little thing"
say Sheep.^find_method('roar').WHY; # "not too scary"
say Sheep.^find_method('roar').WHY; # "not too scary"</lang>
</lang>


A compiler has a built-in <code>--doc</code> switch that will generate documentation from a given source file.
A compiler has a built-in <code>--doc</code> switch that will generate documentation from a given source file.