Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Perl have something like Java/PHP Docs?

Does Perl have a Perl Docs generator? Something like Java Docs or PHP Documenter?

like image 281
Phill Pafford Avatar asked Jan 25 '10 16:01

Phill Pafford


4 Answers

Yes, it's called 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.

like image 113
amarillion Avatar answered Oct 24 '22 14:10

amarillion


Why, yes. Yes, it does! Perldoc.

like image 25
Paul Nathan Avatar answered Oct 24 '22 13:10

Paul Nathan


You mean perldoc?

Also see this related Stack Overflow quesion:

  • What’s the best way to document Perl code?
like image 24
Gordon Avatar answered Oct 24 '22 12:10

Gordon


[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.

like image 2
Pablo Marin-Garcia Avatar answered Oct 24 '22 13:10

Pablo Marin-Garcia