Course of Raku / Advanced / Testing and documentation 🆕 / Documenting code 🆕 / Exercises / A Pod section
Solution: A Pod section
Here is a possible solution to the task.
Code
=begin pod
=head1 My Module
This module does something useful.
=end pod
say $=pod[0].contents.elems;🦋 You can find the source code in the file a-pod-section.raku.
Output
2Comments
$=podholds the file’s Pod as a list of blocks;$=pod[0]is the single=begin podblock.Its
.contentsare the blocks nested inside it — the=head1heading and the paragraph — so.contents.elemsis2. Walking into the structure like this is how a program reads its own documentation as data.