Does Perl have a Perl Docs generator? Something like Java Docs or PHP Documenter?
-
11POD? Conversion to or from POD? People write books in POD! Search CPAN for POD! POD people! – Anonymous Jan 25 '10 at 16:54
-
1Here's the wikipedia page on POD: http://en.wikipedia.org/wiki/Plain_Old_Documentation – draegtun Jan 25 '10 at 18:48
4 Answers
Yes, it's called POD (formerly: perldoc)
You simply write documentation in the source, just like with javadoc.
Briefly, "=item" is a bulleted item, e.g. a function or a parameter "=over" goes down a level of identation, "=back" goes up a level. Use "=cut" where you want to switch back to perl code.
Here is an example of what it could look like:
=item $b->add_module ( %options )
Initialize a module. A module is a repository or a branch of a repository.
Valid options are
=over
=item id
Id of this module
=item repo
Url of repository. Currently only subversion repositories are supported.
=back
=cut
sub add_module($%)
{
Simply pass your perl code through the perldoc program to get the formatted documentation.

- 24,487
- 15
- 68
- 80
-
1Well, it's quite different from JavaDoc or PHPDoc in regards to how you document things, but afaik it is the standard documentation tool – Gordon Jan 25 '10 at 17:02
-
4I would highly suggest not ever using pod between code (interlaced), as the markup is really bloated and will just serve to obfuscate navigation and code coherency. Write self-documenting code, and put the pod at the bottom of the document below an `__END__` tag. – Evan Carroll Jan 25 '10 at 17:22
-
4responding to Evan Carroll - this is just personal preference - i generally prefer interlaced pod, it makes it much easier to keep the documentation up-to-date, and any decent editor will make it easy to see what's code and what's pod. – plusplus Jan 25 '10 at 18:01
[just for googlers] As people already said, you make documentation with POD (not comments, comments are for maintainers, pod for user documentation). Usually you add your POD at the start and end of your script or module, and before each method), then you can use perldoc your_module
in the console, or pod2html
to convert to html and browse in a server, or use pdoc (it is a bit old but is very helpful when you want to have a web doc navigator and links to the code in the web).
there is a newer question about formatting the pod that could be also of your interest perl-documentation-pod-browsers
and this one how-can-i-generate-html-documentation-for-perl-code-comments
And there was another one talking about to do a pod2html and using a css file to mimic the cpansearch pages, but I can not find it now.

- 1
- 1

- 4,151
- 2
- 32
- 50